NMath Stats User's Guide

TOC | Previous | Next | Index

9.4 One Sample Anderson-Darling Test (.NET, C#, CSharp, VB, Visual Basic, F#)

Class OneSampleAndersonDarlingTest performs a Anderson-Darling test of the distribution of one sample. An Anderson-Darling test compares the distribution of a given sample to normal distribution function (CDF). The alternative hypothesis that the data do not have a normal distribution.

Code Example – C# Anderson-Darling test

int n = 100;
DoubleVector data =
  new DoubleVector( n, new RandGenGamma( 23.0 ) );
OneSampleAndersonDarlingTest test =
  new OneSampleAndersonDarlingTest( data );

Console.WriteLine( "statistic = " + test.Statistic );
Console.WriteLine( "p-value = " + test.P );
Console.WriteLine( "alpha = " + test.Alpha );
Console.WriteLine( "reject the null hypothesis? " + test.Reject);

Top

Top