Troubles with Lillietest and chi2gof

2 次查看(过去 30 天)
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.

采纳的回答

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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Hypothesis Tests 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by