[R] shapiro wilk normality test
Greg Snow
Greg.Snow at imail.org
Mon Jul 14 22:58:13 CEST 2008
For those people who feel the need for a p-value to test normality on large sample sizes, I propose the following test/function:
SnowsPenultimateNormalityTest <- function(x){
# the following function works for current implementations of R
# to my knowledge, eventually it may need to be expanded
is.rational <- function(x){
rep( TRUE, length(x) )
}
tmp.p <- if( any(is.rational(x))) {
0
} else {
# current implementation will not get here
# this part is reserved for the ultimate test
1
}
out <- list(
p.value = tmp.p,
alternative = strwrap(paste('The data does not come from a',
'strict normal distribution (but may represent a distribution',
'that is close enough)'), prefix="\n\t"),
method = "Snow's Penultimate Normality Test",
data.name = deparse(substitute(x))
)
class(out) <- 'htest'
out
}
Now that the need for a p-value is satisfied, we can get onto the more useful questions mentioned in this thread and other places.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Bunny,
> lautloscrew.com
> Sent: Saturday, July 12, 2008 10:20 AM
> To: Mark Leeds
> Cc: r-help at r-project.org
> Subject: Re: [R] shapiro wilk normality test
>
> Hmm thanks,
> But on the other hand it just says i cant reject normality,
> which doesnt really mean it is normal. Wouldn´t be nice to
> test for non- normality ? if i´d reject that a high level i
> could be pretty sure it ´s normal... ??
>
> thanks in advance
>
> matthias
> Am 12.07.2008 um 18:10 schrieb Mark Leeds:
>
> > Hi: If normality is the HO, then the test below says don't reject (
> > large p value ). Check out any multivariate text for what
> the null of
> > the shapiro test is. I don't know for sure but, from below, it sure
> > looks like HO is normality. Or google for it.
> >
> >
> >
> > -----Original Message-----
> > From: r-help-bounces at r-project.org
> > [mailto:r-help-bounces at r-project.org
> > ] On
> > Behalf Of Bunny, lautloscrew.com
> > Sent: Saturday, July 12, 2008 11:30 AM
> > To: r-help at r-project.org
> > Subject: [R] shapiro wilk normality test
> >
> > Hi everybody,
> >
> > somehow i dont get the shapiro wilk test for normality. i
> just can´t
> > find what the H0 is .
> >
> > i tried :
> >
> > shapiro.test(rnorm(5000))
> >
> > Shapiro-Wilk normality test
> >
> > data: rnorm(5000)
> > W = 0.9997, p-value = 0.6205
> >
> >
> > If normality is the H0, the test says it´s probably not
> normal, doesn
> > ´t it ?
> >
> > 5000 is the biggest n allowed by the test...
> >
> > are there any other test ? ( i know qqnorm already ;)
> >
> > thanks in advance
> >
> > matthias
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list