Effacer les filtres
Effacer les filtres

Troubles with Lillietest and chi2gof

1 vue (au cours des 30 derniers jours)
Sasi
Sasi le 26 Jan 2012
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.

Réponse acceptée

Wayne King
Wayne King le 26 Jan 2012
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);
  2 commentaires
Sasi
Sasi le 26 Jan 2012
So you mean the answer of [h,p]=chi2gof(x); and [h,p]=lillietest(x)should be the same?
Wayne King
Wayne King le 26 Jan 2012
You cannot guarantee that they will always be the same.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by