LillieforsTest Class 
Namespace: Accord.Statistics.Testing
[SerializableAttribute] public class LillieforsTest : HypothesisTest<EmpiricalDistribution>, IHypothesisTest<EmpiricalDistribution>, IHypothesisTest
The LillieforsTest type exposes the following members.
Name  Description  

LillieforsTest 
Creates a new OneSample Lilliefors' KolmogorovSmirnov test.

Name  Description  

CriticalValue 
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.)  
EmpiricalDistribution 
Gets the empirical distribution measured from the sample.
 
Hypothesis 
Gets the alternative hypothesis under test. If the test is
Significant, the null hypothesis
can be rejected
in favor of this alternative hypothesis.
 
NumberOfSamples 
Gets the number of observations in the sample being tested.
 
PValue 
Gets the Pvalue associated with this test.
(Inherited from HypothesisTestTDistribution.)  
Significant 
Gets whether the null hypothesis should be rejected.
(Inherited from HypothesisTestTDistribution.)  
Size 
Gets the significance level for the
test. Default value is 0.05 (5%).
(Inherited from HypothesisTestTDistribution.)  
Statistic 
Gets the test statistic.
(Inherited from HypothesisTestTDistribution.)  
StatisticDistribution 
Gets the distribution associated
with the test statistic.
(Inherited from HypothesisTestTDistribution.)  
Tail 
Gets the test type.
(Inherited from HypothesisTestTDistribution.)  
TheoreticalDistribution 
Gets the hypothesized distribution for the samples.

Name  Description  

Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
GoodnessOfFitTDistribution 
Performs a GoodnessofFit method by automatically creating and fitting
the chosen distribution to the samples and computing a LillieforsTest
against this fitted distribution.
 
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
OnSizeChanged 
Called whenever the test significance level changes.
(Inherited from HypothesisTestTDistribution.)  
PValueToStatistic 
Converts a given pvalue to a test statistic.
(Overrides HypothesisTestTDistributionPValueToStatistic(Double).)  
StatisticToPValue 
Converts a given test statistic to a pvalue.
(Overrides HypothesisTestTDistributionStatisticToPValue(Double).)  
ToString 
Converts the numeric PValue of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.)  
ToString(String, IFormatProvider) 
Converts the numeric PValue of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual  Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices. (Defined by Matrix.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by Matrix.) 
In statistics, the Lilliefors test, named after Hubert Lilliefors, professor of statistics at George Washington University, is a test based on the Kolmogorov–Smirnov test. It is used to test the null hypothesis that data come from a normally distributed population, when the null hypothesis does not specify which normal distribution; i.e., it does not specify the expected value and variance of the distribution.
Contrary to the KolmogorovSmirnov test, this test can be used to assess the likelihood that a given sample could have been generated from a distribution that has been fitted from the data.
References:
In this first example, suppose we got a new sample, and we would like to test whether this sample has been originated from a uniform continuous distribution. Unlike KolmogorovSmirnovTest, we can actually use this test whether the data fits a distribution that has been estimated from the data.
// Test against a Uniform distribution fitted from the data // Make this example reproducible Accord.Math.Random.Generator.Seed = 1; // Suppose we got a new sample, and we would like to test whether this // sample seems to have originated from a uniform continuous distribution. // double[] sample = { 0.021, 0.003, 0.203, 0.177, 0.910, 0.881, 0.929, 0.180, 0.854, 0.982 }; // First, we create the distribution we would like to test against: // var distribution = UniformContinuousDistribution.Estimate(sample); // Now we can define our hypothesis. The null hypothesis is that the sample // comes from a standard uniform distribution, while the alternate is that // the sample is not from a standard uniform distribution. // var lillie = new LillieforsTest(sample, distribution, iterations: 10 * 1000 * 1000); double statistic = lillie.Statistic; // 0.36925 double pvalue = lillie.PValue; // 0.09057 bool significant = lillie.Significant; // false // Since the null hypothesis could not be rejected, then the sample // can perhaps be from a uniform distribution. However, please note // that this doesn't means that the sample *is* from the uniform, it // only means that we could not rule out the possibility.
We can also check whether a Normal distribution fitted on the data is a good candidate model for the samples:
// Test against a Normal distribution // Make this example reproducible Accord.Math.Random.Generator.Seed = 1; // This time, let's see if the same sample from the previous example // could have originated from a fitted Normal (Gaussian) distribution. // double[] sample = { 0.021, 0.003, 0.203, 0.177, 0.910, 0.881, 0.929, 0.180, 0.854, 0.982 }; // Before we could not rule out the possibility that the sample came from // a uniform distribution, which means the sample was not very far from // uniform. This would be an indicative that it would be far from what // would be expected from a Normal distribution: NormalDistribution distribution = NormalDistribution.Estimate(sample); // Create the test var lillie = new LillieforsTest(sample, distribution); double statistic = lillie.Statistic; // 0.2882 double pvalue = lillie.PValue; // 0.0207 bool significant = lillie.Significant; // true // Since the test says that the null hypothesis should be rejected, then // this can be regarded as a strong indicative that the sample does not // comes from a Normal distribution, just as we expected.