| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
h = lillietest(x)
h = lillietest(x,alpha)
h = lillietest(x,alpha,distr)
[h,p] = lillietest(...)
[h,p,kstat] = lillietest(...)
[h,p,kstat,critval] = lillietest(...)
[h,p,...] = lillietest(x,alpha,distr,mctol)
h = lillietest(x) performs a Lilliefors test of the default null hypothesis that the sample in vector x comes from a distribution in the normal family, against the alternative that it does not come from a normal distribution. The test returns the logical value h = 1 if it rejects the null hypothesis at the 5% significance level, and h = 0 if it cannot. The test treats NaN values in x as missing values, and ignores them.
The Lilliefors test is a 2-sided goodness-of-fit test suitable when a fully-specified null distribution is unknown and its parameters must be estimated. This is in contrast to the one-sample Kolmogorov-Smirnov test (see kstest), which requires that the null distribution be completely specified. The Lilliefors test statistic is the same as for the Kolmogorov-Smirnov test:
![]()
where SCDF is the empirical cdf estimated from the sample and CDF is the normal cdf with mean and standard deviation equal to the mean and standard deviation of the sample.
lillietest uses a table of critical values computed using Monte Carlo simulation for sample sizes less than 1000 and significance levels between 0.001 and 0.50. The table is larger and more accurate than the table introduced by Lilliefors. Critical values for a test are computed by interpolating into the table, using an analytic approximation when extrapolating for larger sample sizes.
h = lillietest(x,alpha) performs the test at significance level alpha. alpha is a scalar in the range [0.001, 0.50]. To perform the test at a significance level outside of this range, use the mctol input argument.
h = lillietest(x,alpha,distr) performs the test of the null hypothesis that x came from the location-scale family of distributions specified by distr. Acceptable values for distr are 'norm' (normal, the default), 'exp' (exponential), and 'ev' (extreme value). The Lilliefors test can not be used when the null hypothesis is not a location-scale family of distributions.
[h,p] = lillietest(...) returns the p-value p, computed using inverse interpolation into the table of critical values. Small values of p cast doubt on the validity of the null hypothesis. lillietest warns when p is not found within the tabulated range of [0.001, 0.50], and returns either the smallest or largest tabulated value. In this case, you can use the mctol input argument to compute a more accurate p-value.
[h,p,kstat] = lillietest(...) returns the test statistic kstat.
[h,p,kstat,critval] = lillietest(...) returns the critical value critval for the test. When kstat > critval, the null hypothesis is rejected at significance level alpha
[h,p,...] = lillietest(x,alpha,distr,mctol) computes a Monte Carlo approximation for p directly, rather than interpolating into the table of pre-computed values. This is useful when alpha or p lie outside the range of the table. lillietest chooses the number of Monte Carlo replications, mcreps, large enough to make the Monte Carlo standard error for p, sqrt(p*(1-p)/mcreps), less than mctol.
Use lillietest to determine if car mileage, in miles per gallon (MPG), follows a normal distribution across different makes of cars:
load carbig.mat
[h,p] = lillietest(MPG)
Warning: P is less than the smallest tabulated value, returning 0.001.
h =
1
p =
1.0000e-003This is clear evidence for rejecting the null hypothesis of normality, but the p-value returned is just the smallest value in the table of pre-computed values. To find a more accurate p-value for the test, run a Monte Carlo approximation using the mctol input argument:
[h,p] = lillietest(MPG,0.05,'norm',1e-4)
h =
1
p =
8.3333e-006[1] Conover, W. J. Practical Nonparametric Statistics. Hoboken, NJ: John Wiley & Sons, Inc., 1980.
[2] Lilliefors, H. W. "On the Kolmogorov-Smirnov test for the exponential distribution with mean unknown." Journal of the American Statistical Association. Vol. 64, 1969, pp. 387–389.
[3] Lilliefors, H. W. "On the Kolmogorov-Smirnov test for normality with mean and variance unknown." Journal of the American Statistical Association. Vol. 62, 1967, pp. 399–402.
jbtest, kstest, kstest2, cdfplot
![]() | lhsnorm | linhyptest | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |