Examples - pi.science.hypothesistesting.PIKolmogorovSmirnov
1. How to check if sample belongs to a normal distribution using Kolmogorov-Smirnov test ?
PIVariable var = new PIVariable(); var.AddValues( new double[] { 1.2, 1.6, 1.8, 1.9, 1.9, 2.0, 2.2, 2.6, 3.0, 3.5, 4.0, 4.8, 5.6, 6.6, 7.6 } ); PIKolmogorovSmirnov test = new PIKolmogorovSmirnov( var ); test.Evaluate(); Console.WriteLine( "n = " + test.VarData.Count() ); Console.WriteLine( "D value = " + test.D ); Console.WriteLine( "p-value = " + test.PValue ); Console.WriteLine( test.ToString() );
Output:
n = 15 D value = 0,187498763366733 p-value = 0,2 H0 hypothesis -> accepted (0,05).