[R] completely different results for shapiro.test and ks.test

Marc Schwartz marc_schwartz at me.com
Thu Mar 27 20:54:39 CET 2014


On Mar 27, 2014, at 8:14 AM, Hermann Norpois <hnorpois at gmail.com> wrote:

> Hello,
> 
> My main question is wheter my data is distributed normally. As the
> shapiro.test doesnt work for large
> data sets I prefer the ks.test.
> But I have some problems to understand the completely different p-values:
> 
>> ks.test (test, pnorm, mean (test), sd (test))
> 
>    One-sample Kolmogorov-Smirnov test
> 
> data:  test
> D = 0.0434, p-value = 0.1683
> alternative hypothesis: two-sided
> 
> Warnmeldung:
> In ks.test(test, pnorm, mean(test), sd(test)) :
>  für den Komogorov-Smirnov-Test sollten keine Bindungen vorhanden sein
>> shapiro.test (test)
> 
>    Shapiro-Wilk normality test
> 
> data:  test
> W = 0.9694, p-value = 1.778e-10
> 
> 
> Generating some random data the difference is acceptable:
> 
>> nt <- rnorm (200, mean=5, sd=1)
>> ks.test (nt, pnorm, mean=5, sd=1)
> 
>    One-sample Kolmogorov-Smirnov test
> 
> data:  nt
> D = 0.0641, p-value = 0.3841
> alternative hypothesis: two-sided
> 
>> shapiro.test (nt)
> 
>    Shapiro-Wilk normality test
> 
> data:  nt
> W = 0.9933, p-value = 0.5045
> 
> 
> Thanks
> hermann

<snip>

The discussion here (and other similar ones) might be helpful:

  http://stats.stackexchange.com/questions/362/what-is-the-difference-between-the-shapiro-wilk-test-of-normality-and-the-kolmog

You may also be served by searching the R-Help list archives for prior discussions on using normality tests and why they are essentially useless in practice.

Regards,

Marc Schwartz




More information about the R-help mailing list