IStatistics.Pearson

Syntax

Pearson(A1: Array; A2: Array): Double;

Parameters

A1. Independent series

A2. Dependent series.

Description

The Pearson method returns Pearson correlation coefficient.

Comments

For correct calculation the A1 and A2 series:

Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    st: Statistics;
    d0: Double;
    y, x: Array 
Of Double;
Begin
    y := 
New Double[8];
    y[
00] := 6; y[04] := 21;
    y[
01] := 7; y[05] := 24;
    y[
02] := 9; y[06] := 25;
    y[
03] := 15; y[07] := 21;
    x := 
New Double[8];
    x[
00] := 20; x[04] := 40;
    x[
01] := 28; x[05] := 43;
    x[
02] := 31; x[06] := 51;
    x[
03] := 38; x[07] := 57;
    st := 
New Statistics.Create;
    d0 := st.Pearson(y, x);
    
If st.Status <> 0 Then
        Debug.WriteLine(st.Errors);
    
Else
        Debug.WriteLine(
"Pearson coefficient: " + d0.ToString);
    
End If;
End Sub UserProc;

After executing the example the console window displays correlation coefficient:

See also:

IStatistics