Very small p value
조회 수: 13 (최근 30일)
이전 댓글 표시
I am using chi2gof to test whether my data is distributed normally. Graphically, it looks very normal, and I have fitted a normal curve to it that 'looks' good.
[h,p]=chi2gof(histdata)
h =
1
p =
0
Chi2gof reports the p value as zero - any advice on calculating the actual p value? I need to know if it is p < 0.0001 or p < 0.0000001 or whatever.
댓글 수: 0
채택된 답변
Wayne King
2011년 11월 10일
Hi Micah, A couple things to try:
Set the format to long.
format long
[h,p] = chi2gof(histdata)
It may be that the p-value is really essentially zero, I mean if the p-value is 10^{-6}, are you really going to report that? You may as well just say p<0.001
Another thing is return the stats from chi2gof() and check that.
[h,p,st] = chi2gof(histdata);
1-chi2cdf(st.chi2stat,st.df)
Does that also just say 0?
댓글 수: 0
추가 답변 (1개)
Peter Perkins
2011년 11월 11일
Micah, in recent versions of the Statistics Toolbox, chi2gof will definitely compute very small p-values correctly. In older versions, it is possible for the p-value to round down to zero if it is very small (but it'd have to be much smaller than the 1e-4 you give as an example). If you have an older version, you can still probably compute the p-value by getting the chi-squared statistic and the degrees of freedom from the third output from chi2gof, and compute the p-value as
p = gammainc(chi2stat/2,df/2,'upper')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Hypothesis Tests에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!