[R] normality test on truncated data

From: Yong Chao <yc176_at_yahoo.com>
Date: Fri 04 Feb 2005 - 09:59:33 EST

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?



> 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


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Feb 04 09:13:06 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 01:27:29 EST