ISlFisherTestSample.Average

Syntax

Average: Double;

Description

The Average property returns sample mean.

Example

Sub Main;

Var

Ftest: ISmFisherTest;

res: Integer;

mA: Array[7] Of Double;

mB: Array[9] Of Double;

SA,SB: ISlFisherTestSample;

Begin

Ftest := New SmFisherTest.Create;

mA[0] := 1; mB[0] := 1;

mA[1] := 2; mB[1] := 2;

mA[2] := 3; mB[2] := 3;

mA[3] := 4; mB[3] := 4;

mA[4] := 5; mB[4] := 10;

mA[5] := 6; mB[5] := 11;

mA[6] := 7; mB[6] := 12;

mB[7] := 13;

mB[8] := 14;

SA := Ftest.SampleA;

SB := Ftest.SampleB;

SA.Sample.Value := mA;

SB.Sample.Value := mB;

Ftest.ConfidenceLevel := 0.05;

res := Ftest.Execute;

If res <> 0 Then

Debug.WriteLine(Ftest.Errors);

Else

Debug.WriteLine("Mean A: " + SA.Average.ToString);

Debug.WriteLine("Mean B: "+ SB.Average.ToString);

Debug.WriteLine("Variance A: "+ SA.Variance.ToString);

Debug.WriteLine("Variance B:"+ SB.Variance.ToString);

Debug.WriteLine("Fisher statistic: " + Ftest.FisherStatistics.ToString);

Debug.WriteLine("Criterion of Fisher statistics significance: " + Ftest.FisherCritical.ToString);

If Ftest.FisherTestResult Then

Debug.AssertMsg(False, "Fstat > Fcrit. Accept hypothesis on variance equality.");

Else

Debug.AssertMsg(False, "Fstat < Fcrit. Reject hypothesis on variance equality");

End If;

End If;

End Sub Main;

After executing the example the console window displays results of test calculation:

Module execution started

Mean A: 4

Mean B: 7.7777777777777777

Variance A: 4

Variance B:23.950617283950617

Fisher statistic: 0.1670103092783505

Criterion of Fisher statistics significance: 0.24114956083079916

Fstat < Fcrit. Accept hypothesis on variances' equality

Module execution finished

See also:

ISlFisherTestSample