IStatistics.ChiTest

Syntax

ChiTest(ActualRange: Array; ExpectedRange: Array): Double;

Parameters

ActualRange. Data range that contains the observations to be compared with the expected values.

ExpectedRange. Data range that contains the ratio of products of rows and columns totals to the general total.

Description

The ChiTest method returns independence criterion: that is, probability of χ2 (ch-square) distribution for corresponding number of degrees of freedom.

Comments

The χ2 criterion is used to determine whether the hypothesis is confirmed by an experiment.

The ActualRange and ExpectedRange arrays must match in size. The ActualRange array must also contain only non-negative values, and the ExpectedRange array must contain only positive values.

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[23];
    x := New Double[23];
    y[00] := 58; y[10] := 35;
    y[01] := 11; y[11] := 25;
    y[02] := 10; y[12] := 23;
    x[00] := 45.35; x[10] := 47.65;
    x[01] := 17.56; x[11] := 18.44;
    x[02] := 16.09; x[12] := 16.91;
    st := New Statistics.Create;
    d0 := st.ChiTest(y, x);
    If st.Status <> 0 Then
        Debug.WriteLine(st.Errors);
    Else
        Debug.WriteLine("Value of independence criterion: " + d0.ToString);
    End If;
End Sub UserProc;

After executing the example the console window displays the independence criterion value.

See also:

IStatistics | Chi-test