Lilliefors test critical values

4 views (last 30 days)
btåla
btåla on 30 Jan 2017
Commented: Peter Perkins on 31 Jan 2017
Can anyone give me some insights on how the tabulated values ( cv's) are calculated in the Lillitest function. The point is that, Lillitest performs the modified version of KS test when the distribution parameters are estimated from the sample data. But unfortunately it is limited to some of the distributions, i.e. normal,exp,weibull, extreme value and lognormal. My interest is to make use of such test even for other distributions, i.e. Log-logistic, Gamma etc. (if it is possible, but I guess it should be). I do not know how the tabulated values for specific significance values and sample sizes, when considering the distributions implemented in Lilliefors tests, are calculated? If the the sample size is larger than those provided in Lillitest, then an asymptotic aprox is computed, but again I do not get how these values are set ?? Even having a look at the references in the func, I was not able to clear these doubts. Whereas, when using MC simulations you calculate the specific cv's and p-values running Montecarlo simulations. In this case, the cv's does not change except for the p-values but when I tried to include a version of Gamma I do not know which values to start with (scale0 and shape0) :
% Simulate critical values for the extreme value
case {'extreme value', 'ev'}
mu0 = 0; sigma0 = 1;
yCDF = (0:n)'/n;
for rep = 1:length(KSstatMC)
x = evrnd(mu0,sigma0,n,1);
xCDF = sort(x); % unique values, no need for ECDF
phat = evfit(x); % MLE fit to the data
nullCDF = evcdf(xCDF, phat(1), phat(2));
delta1 = yCDF(1:end-1) - nullCDF;
delta2 = yCDF(2:end) - nullCDF;
KSstatMC(rep) = max(abs([delta1; delta2]));
end
% Simulate critical values for the gamma
case {'gamma'}
scale0 = 1; shape0 = 1;
yCDF = (0:n)'/n;
for rep = 1:length(KSstatMC)
x = gamrnd(scale0,shape0,n,1);
xCDF = sort(x); % unique values, no need for ECDF
phat = gamfit(x); % MLE fit to the data
nullCDF = evcdf(xCDF, phat(1), phat(2));
delta1 = yCDF(1:end-1) - nullCDF;
delta2 = yCDF(2:end) - nullCDF;
KSstatMC(rep) = max(abs([delta1; delta2]));
end
with the first case being available in the function and the second representing my try. Any input is welcome. Thanks,

Accepted Answer

Peter Perkins
Peter Perkins on 30 Jan 2017
As the documentation says, "The Lilliefors test cannot be used when the null hypothesis is not a location-scale family of distributions." The test assumes a location-scale family. The gamma is not location-scale.
The MC code in the lillietest function is the way the tabulated critical values were computed - the lookup table is just to get the result in a more resonable amount of time. MC simulation is how LillieFohrs did it in the 1960's, albeit with much less computing power.
  2 Comments
btåla
btåla on 30 Jan 2017
Thanks for the reply,
I had a doubt on that as well but since the weibull (3 param distribution, i.e. location, shape and scale) is provided even though through the log(X) for an extreme value I thought it could be valid even for other 3 params distributions. But maybe I am missing something because even other works as those of Cortes and Woodruff does not provide tables for distribution with all the 3 parameters being unknown.
Peter Perkins
Peter Perkins on 31 Jan 2017
The weibull referred to in the lillietest assumes a known location, making its log a location scale family.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!