Covar(A1: Array; A2: Array): Double;
A1. First array of values;
A2. Second array of values.
The Covar method returns covariance, that is the mean of deviation products for each pair of data points.
Covariance is used to determine correlation between two sets of data.
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[10];
x := New Double[10];
y[00] := 1.6; x[00] := 2;
y[01] := 1.7; x[01] := 4;
y[02] := 1.8; x[02] := 2;
y[03] := 1.9; x[03] := 5;
y[04] := 2; x[04] := 12;
y[05] := 2.1; x[05] := 6;
y[06] := 2.2; x[06] := 15;
y[07] := 2.3; x[07] := 17;
y[08] := 2.4; x[08] := 14;
y[09] := 2.8; x[09] := 3;
st := New Statistics.Create;
d0 := st.Covar(y,x);
Debug.WriteLine("Covariation: " + d0.ToString);
End Sub UserProc;
Executing this example shows the covariance value in the console window:
Module execution started
Covariance: 0.73999999999999977
Module execution finished
See also: