MATLAB: Troubles with Lillietest and chi2gof

chi2gofhypothesis testslillietestMATLABStatistics and Machine Learning Toolbox

Hi
I generate 100 numbers which came from a normal distribution, and when I use lillietest I get the answer h=0 but when I use the chi2gof test I get the answer h=1.
here is my codes:
A=randn(1,100);
chi2gof(A,'cdf',@(z)normcdf(z,mean(A),std(A)),'nparams',2)
ans =
1
lillietest(A)
ans =
0
can someone please explain why it is like this?
Tanx
[Merged information from other question]
Hello,
I have a problem with hypothesis tests in MATLAB. I have a dataset and I want to know what is the distribution of this dataset. At the first try I used Lillietest which can show me if my data is coming from a normal distribution family or not. At second try I used chi2gof test. Here is the problem, the data which lillietest find it normally distributed, chi2gof test finds it not normally distributed. I want to know what is the difference between this two tests.

Best Answer

I don't get that Sasi:
rng default; % let's make sure we're using the same vector
x = randn(100,1);
[h,p] = chi2gof(x,'cdf',{@normcdf,mean(x),std(x)});
Note that the above is the same as:
[h,p] = chi2gof(x);
hL = lillietest(x);