NormalityTest,shapiro_wilk_pvalue works incorrectly?
Java library of statistical distribution
Brought to you by:
robbyjo
Hi,
I just started to use JDistlib to calculate normality.
It calculates W with NormalityTest.shapiro_wilk_statistic(x) as it is supposed to.
But when I try to calculate p-value using NormalityTest,shapiro_wilk_pvalue(w,x.length) the result is different than I expected.
E.g. for n=10 and W=0.842 p-value should be around 0.05 (according to S-W tables like http://www.real-statistics.com/wp-content/uploads/2012/12/image3742.png)
but
NormalityTest.shapiro_wilk_pvalue(0.842, 10) returns p=3.3858759941785735E-48
Interestingly for n=10:
w=0.90 p=9.366645710023918E-12
w=0.95 p=0.9999199643824663
Could you explain how it works (if it is not a bug)?
Thanks in advance - BTW I find your library very helpful and simple to use,
Anonymous
Hi there. Thanks! Could you please give me an example dataset?
Perhaps to give you more information, I translated the algorithm from R directly. R used algorithm AS R94 (See Royston 1995):
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/shapiro.test.html
I did a quick check on how it performs and the output matches exactly with R. If you suspect that there is a bug, then it could very well be R's bug. This is why I need the exact example dataset so that I can report back to R maintainers.
The table you referenced might be taken from an older algorithm.
Forget about what I just said. It is indeed a bug. Fixed in version 0.4.4. Thank you so much!
Test case JDistlib:
Test case R:
Correct w = 0.8346663
Correct p-value = 0.0009134905
View and moderate all "tickets Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Tickets"
Thank you! Now it works perfectly :)