# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.test.distribution.normality

## Class Lilliefors

• public class Lilliefors
extends HypothesisTest
Lilliefors test tests the null hypothesis that data come from a normally distributed population with an estimated sample mean and variance. The test statistic is the maximal absolute difference between empirical and the hypothetical Normal distribution function. Since the hypothesized cdf has been moved closer to the data by estimation based on the data, the "null distribution" of the test statistic, i.e. its probability distribution assuming the null hypothesis is true, is stochastically smaller than the Kolmogorov-Smirnov distribution, hence the Lilliefors distribution.

In this implementation, we first compute the p-value from the Dallal-Wilkinson (1986) formula, which is claimed to be only reliable when the p-value is smaller than 0.1. When this p-value is > 0.1, we compute again the p-value from the distribution of the modified statistic (Stephen 1974).

The R equivalent function is lillie.test in package nortest.

• G. E. Dallal, L. Wilkinson, "An analytic approximation to the distribution of Lilliefors' test for normality," The American Statistician, 40, 294-296, 1986.
• M. A. Stephens, "EDF statistics for goodness of fit and some comparisons," Journal of the American Statistical Association, 69, 730-737, 1974.
• Wikipedia: Lilliefors test
• ### Constructor Summary

Constructors
Constructor and Description
Lilliefors(double[] sample)
Perform the Lilliefors test to test for the null hypothesis that data come from a normally distributed population with an estimated sample mean and variance.
• ### Method Summary

All Methods
Modifier and Type Method and Description
String getAlternativeHypothesis()
Get the description of the alternative hypothesis.
String getNullHypothesis()
Get a description of the null hypothesis.
double pValue()
Get the p-value for the test statistics.
double statistics()
Get the test statistics.
• ### Methods inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest

isNullRejected, nGroups, nObs, oneSidedPvalue
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### Lilliefors

public Lilliefors(double[] sample)
Perform the Lilliefors test to test for the null hypothesis that data come from a normally distributed population with an estimated sample mean and variance.
Parameters:
sample - a sample
• ### Method Detail

• #### getNullHypothesis

public String getNullHypothesis()
Description copied from class: HypothesisTest
Get a description of the null hypothesis.
Specified by:
getNullHypothesis in class HypothesisTest
Returns:
the null hypothesis description
Wikipedia: Null hypothesis
• #### getAlternativeHypothesis

public String getAlternativeHypothesis()
Description copied from class: HypothesisTest
Get the description of the alternative hypothesis.
Specified by:
getAlternativeHypothesis in class HypothesisTest
Returns:
the alternative hypothesis description
Wikipedia: Alternative hypothesis
• #### statistics

public double statistics()
Description copied from class: HypothesisTest
Get the test statistics.
Specified by:
statistics in class HypothesisTest
Returns:
the test statistics
Wikipedia: Test statistic
• #### pValue

public double pValue()
Description copied from class: HypothesisTest
Get the p-value for the test statistics.
Specified by:
pValue in class HypothesisTest
Returns:
the p-value