Show contents 

Stat Assembly > Stat Assembly Interfaces > IStatistics > IStatistics.Covar

IStatistics.Covar

Syntax

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

Parameters

A1. First array of values;

A2. Second array of values.

Description

The Covar method returns covariance, that is the mean of deviation products for each pair of data points.

Comments

Covariance is used to determine correlation between two sets of data.

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[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("Covariance: " + d0.ToString);
End Sub UserProc;

Executing the example shows the covariance value in the console window:

Unit execution started

Covariance: 0.74

Unit execution finished

See also:

IStatistics | Correlation coefficient