[R] normality test on truncated data

Yong Chao yc176 at yahoo.com
Thu Feb 3 23:59:33 CET 2005


I tried to use shapiro.test or ks.test to check the
normality of some data, the problem is, the
distribution function is a mixture of a Gaussian and
some other distributions at the tails. The hypothesis
is that if the tails are excluded, the distribution is
perfect Gaussian, and I want to test that.

But I cannot simply cut the tails off and do a
normality test on the truncated data, as shown in the
following example, this will fail.


So that question is: how can I test whether the middle
chunk of the distribution is Gaussian?

Thanks!

Yong

> r<-rnorm(1000)
> r.trunc<-r[which(abs(r)<1.5)]
> shapiro.test(r.trunc)

        Shapiro-Wilk normality test

data:  r.trunc 
W = 0.9855, p-value = 1.237e-07

> ks.test(r.trunc, "pnorm")

        One-sample Kolmogorov-Smirnov test

data:  r.trunc 
D = 0.0873, p-value = 3.116e-06
alternative hypothesis: two.sided 

>




More information about the R-help mailing list