ISmKolmogorovSmirnovTest.Sample2

Syntax

Sample2: ISlSerie;

Description

The Sample2 property determines the second analyzed series.

Comments

In case of two samples distribution type and parameters need to be defined.

Example

Sub main;

Var

can : Array[16] Of Double;

fra : Array[18] Of Double;

met : SmKolmogorovSmirnovTest;

status : Integer;

Begin

can[00] := 6209 ; fra[00] := 4110 ;

can[01] := 6385 ; fra[01] := 4280 ;

can[02] := 6752 ; fra[02] := 4459 ;

can[03] := 6837 ; fra[03] := 4545 ;

can[04] := 6495 ; fra[04] := 4664 ;

can[05] := 6907 ; fra[05] := 4861 ;

can[06] := 7349 ; fra[06] := 5195 ;

can[07] := 7213 ; fra[07] := 5389 ;

can[08] := 7061 ; fra[08] := 5463 ;

can[09] := 7180 ; fra[09] := 5610 ;

can[10] := 7132 ; fra[10] := 5948 ;

can[11] := 7137 ; fra[11] := 6218 ;

can[12] := 7473 ; fra[12] := 6521 ;

can[13] := 7722 ; fra[13] := 6788 ;

can[14] := 8088 ; fra[14] := 7222 ;

can[15] := 8516 ; fra[15] := 7486 ;

fra[16] := 7832 ;

fra[17] := 8941 ;

met := New SmKolmogorovSmirnovTest.Create;

 

met.Sample1.Value := can;

met.Sample2.Value := fra;

met.Hypothesis := KStestHypothesisType.NotEqual;

 

status := met.Execute;

If status = 0 Then

Debug.WriteLine("Deviation (D): "+ met.D.ToString);

Debug.WriteLine("Standardized statistic (Z): "+ met.Z.ToString);

Debug.WriteLine("Probability (P): " + met.P.ToString);

Else

Debug.WriteLine(met.Errors);

End If;

End Sub main;

In this example, distribution of the first sample is compared with the second sample distribution, and the decision is made whether the samples have the same distribution or not. After executing the example the console window displays test results:

Module execution started

Deviation (D): 0.61111111111111116

Standardized statistic (Z): 0.20997297167497347

Probability (P): 0.0013513067694655989

Module execution finished

The samples have different distibution.

See also:

ISmKolmogorovSmirnovTest