5
$\begingroup$

I have a vector of observations called MyData which is a percentile score that is >= 0 and <= 1.

I would like to test the MyData vector for normality. First I plotted the MyData vector vs. a normal distribution with mean= mean(mydata) and sd = sd(mydata). In R I make the normal distribution for comparison with:

rnorm(rnorm(length(mydata), mean(mydata), sd(mydata))

Below you see the histogram and that MyData has a higher number of observations in the middle and higher number of observations in the .8 to 1 bucket.

So the data does not look normal and when I run Jarque-Bera and Shapiro-Wilk tests I get

Jarque-Bera p value = .0007

Shapiro-Wilk p value = .000000006

so those tests also support the non-normality of the data:

hist

My question is: can a distribution that is bounded between >= 0 and <= 1 really be tested for normality? Because as you can see from the histogram below, the normal distribution goes into ranges that MyData does not. Note that the histogram has yellow bins that are below 0 and above 1 which are outside of the possible values of MyData (>= 0 and <=1).

So: what would be the correct way to test for normality in this case, or am I on the right track concluding the data is not normal?

$\endgroup$
1
  • 2
    $\begingroup$ Although I agree with @Ben Bolker that the comparison is of limited use, I'd recommend here a direct quantile-quantile plot (often called a normal probability plot, and various other names). Histograms always raise small or even large questions of the number and width of bins and their origin, which a q-q plot avoids. In R I believe that is usually got with qqnorm(). $\endgroup$
    – Nick Cox
    May 24, 2016 at 16:16

1 Answer 1

12
$\begingroup$

It makes about as much sense to test these data for Normality (specifically, to compute some test statistic and compare it against the distribution of the test statistic expected for samples that truly came from a Normal distribution) as it ever does. If this kind of test is a usual part of your workflow for other data sets, and you think after reading below that it should be, then go ahead and use this test on your current data set. Expanding on that answer ...

There is a strong opinion (that I share) that many of the common applications of normality testing are silly. We know that the null hypothesis is false/any real data set is very, very, very unlikely to actually be Normal (is there some theoretical min or max value to the data? Are the data measured to infinite precision, or only recorded up to some finite precision? Is there any way in which the data are not independent and identically distributed?) The real question is whether the data are close enough to Normality for your current practical purposes, e.g. whether linear models will give a sufficiently accurate answer. While testing the $p$-value might be a silly way to try to answer this question (the linked question emphasizes that the $p$-value will always be small for large data sets), for small to moderate data sets it may be true that $p>0.05$ is approximately equivalent to "the data are close enough to Normality for procedures that assume Normality to be useful". (It would probably be better to use a fixed $W$ value, rather than a fixed $p$ value, for these purposes.)

You could do some numerical experiments to see how big the effects of truncation are (the mean should converge to 0.5 for large cutoff values, since the p-value distribution will be $U(0,1)$, but this plot is quite noisy because the distribution of p-values is highly variable ...)

set.seed(101)
cutvec <- seq(3,1,by=-0.1)
n <- 100
res <- sapply(cutvec,
      function(c) {
         x <- rnorm(n)
         mean(replicate(100000,shapiro.test(x[abs(x)<c])$p.value))
      })
library(ggplot2); theme_set(theme_bw())
ggplot(data.frame(cutvec,res),
       aes(cutvec,res))+
    geom_point()+
    scale_y_log10()+
    geom_smooth()+
    geom_hline(yintercept=0.5,lty=2)

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.