# Re: [R] shapiro wilk normality test

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Mon, 14 Jul 2008 14:58:13 -0600

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... ??
>
>
> 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 ;)
> >
> >
> > matthias
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > 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
> 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