ISmKolmogorovSmirnovTest.D

Fore Syntax

D: Double;

Fore.NET Syntax

D: double;

Description

The D property estimates Kolmogorov-Smirnov statistics , or , according to value of the Hypothesis parameter.

Comments

TO get the probability connected with the obtained value of D, use the ISmKolmogorovSmirnovTest.P property.

Fore Example

Add a link to the Stat system assembly.

Sub UserProc;
Var
    met: SmKolmogorovSmirnovTest;
    can: Array[16Of Double;
    status: Integer;
Begin
    met := New SmKolmogorovSmirnovTest.Create;
    // considered series  
    can[00] := 6209;
    can[01] := 6385;
    can[02] := 6752;
    can[03] := 6837;
    can[04] := Double.Nan;
    can[05] := 6907;
    can[06] := 7349;
    can[07] := 7213;
    can[08] := Double.Nan;
    can[09] := 7180;
    can[10] := 7132;
    can[11] := 7137;
    can[12] := 7473;
    can[13] := 7722;
    can[14] := 8088;
    can[15] := 8516;
    // Set method parameters  
    met.Sample1.Value := can;
    met.MissingData.Method := MissingDataMethod.LinTrend;
    met.ModelPeriod.FirstPoint := 2;
    met.ModelPeriod.LastPoint := 10;
    met.Distribution := KStestDistributionType.Gamma;
    met.Hypothesis := KStestHypothesisType.NotEqual;
    met.SuppliedParameters := True;
    met.Parameter1 := 3;
    met.Parameter2 := 0.2;
    // Calculate method and output results
    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 UserProc;

Check the hypothesis that the sample has gamma distribution. Alternative hypothesis H1 assumes that the data cannot be a random sample of gamma distribution. After executing the example the console window displays test values:

Deviation (D): 1

Standardized statistic (Z): 3

Probability (P): 0

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Stat;

Public Shared Sub Main(Params: StartParams);
Var
    met: SmKolmogorovSmirnovTest;
    can: Array[16Of Double;
    status: Integer;
Begin
    met := New SmKolmogorovSmirnovTest.Create();
    // considered series  
    can[00] := 6209;
    can[01] := 6385;
    can[02] := 6752;
    can[03] := 6837;
    can[04] := Double.Nan;
    can[05] := 6907;
    can[06] := 7349;
    can[07] := 7213;
    can[08] := Double.Nan;
    can[09] := 7180;
    can[10] := 7132;
    can[11] := 7137;
    can[12] := 7473;
    can[13] := 7722;
    can[14] := 8088;
    can[15] := 8516;
    // Set method parameters  
    met.Sample1.Value := can;
    met.MissingData.Method := MissingDataMethod.mdmLinTrend;
    met.ModelPeriod.FirstPoint := 2;
    met.ModelPeriod.LastPoint := 10;
    met.Distribution := KStestDistributionType.kstdtGamma;
    met.Hypothesis := KStestHypothesisType.ksthtNotEqual;
    met.SuppliedParameters := True;
    met.Parameter1 := 3;
    met.Parameter2 := 0.2;
    // Calculate method and output results
    status := met.Execute();
    If status = 0 Then
        System.Diagnostics.Debug.WriteLine("Deviation (D): " + met.D.ToString());
        System.Diagnostics.Debug.WriteLine("Standardized statistic (Z): " + met.Z.ToString());
        System.Diagnostics.Debug.WriteLine("Probability: (P): " + met.P.ToString());
    Else
        System.Diagnostics.Debug.WriteLine(met.Errors);
    End If;
End Sub;

See also:

ISmKolmogorovSmirnovTest