0
$\begingroup$

Have been researching tests for normality, and have some idea of how some of these tests work from Wikipedia.

However, they leave out explaining the distributions of the test statistics under the null and simply tell you to reject the null for certain critical values.

Could someone enlighten me? Is there any distributions for these tests statistics at all?

Update: so I understood that for some of them (such as Shapiro), p values were calculated via Monte Carlo simulations, and p values for AD and SW exist in the form of a table online rather than a known distribution.

Would still appreciate if someone could provide some insight on how they work nevertheless! (finding p values from test statistics under null)

$\endgroup$
0

1 Answer 1

2
$\begingroup$

"I understood that for some of them (such as Shapiro), p values were calculated via Monte Carlo simulations"

Yes, they did so for the Shapiro-Wilk -- though to clarify, it was a combination of simulations (via the use of tables of random numbers, by the way) and approximation of the simulated distribution of the test statistic by Johnson family distributions. Lilliefors also used simulation though if I remember correctly only 1000 random samples so his original tables are a little inaccurate.

Would still appreciate if someone could provide some insight on how they work nevertheless! (finding p values from test statistics under null)

For the moment I'll explain how simulation works for this.

If one were to use simulation with the Shapiro-Wilk, this is straightforward, since it's designed for the null case of a general normal. The properties of it don't depend on which normal you use, so you can just pick a convenient one (which, unsurprisingly, will be the standard normal).

Let's leave aside the Johnson distribution approximation (at least for now), since we can readily simulate very large numbers of values and get as close to the actual percentage points as we like, but smoothing is a good idea, and nigh indispensable when it's hard to do a lot of simulations. I often use some form of nonparametric smoothing when doing either these sorts of simulations or power simulations.

At some given sample size, $n$, the approach would proceed as follows:

Repeat m times:

   - simulate an i.i.d. sample of size n from a normal distribution
   - calculate (and store) the statistic W

We then have a sample of size $m$ from the null distribution of $W_n$, from which we could estimate the percentiles. Since low values of $W$ are inconsistent with $H_0$, we are interested in the lower tail quantiles. We could (at least as a first attempt) simply compute sample quantiles for the 1%, 5% etc points of the distribution of W.

For example, let's get the $1\%$, $2\%$, $5\%$ and $10\%$ percentage points for $n=15$. I'll use R:

m = 1000000; n = 15
W = replicate(m,shapiro.test(rnorm(n))$statistic)
quantile(W,p=c(.01,.02,.05,.10))

for which we get:

> m = 1000000; n = 15
> W = replicate(m,shapiro.test(rnorm(n))$statistic)
> quantile(W,p=c(.01,.02,.05,.10))
       1%        2%        5%       10% 
0.8355581 0.8556774 0.8818629 0.9014565 

Two additional runs produced:

       1%        2%        5%       10% 
0.8358181 0.8560723 0.8818193 0.9012618 
0.8360852 0.8557725 0.8818550 0.9011986 

For comparison, Shapiro & Wilk, 1965 got for their critical values at n=15:

Level:   0.01  0.02  0.05  0.10
n=15:   0.835 0.855 0.881 0.901

You can see there's excellent agreement there to the number of figures they give; at worst they might be out by 1 in the last figure on a couple of them.

You can simply repeat that task for whichever n's you care to tabulate.

For Lilliefors test it's much the same as above.

One simple way to do it would to simulate as before, then internally standardize, before computing a Kolmogorov-Smirnov statistic on a standard normal.

Here I'll use a smaller simulation size because this will be slower; however the smaller size will be adequate. Again I'll repeat the simulation so we can see that we're getting reasonable accuracy. I will use different percentage points to match Lilliefors. Keep in mind that we now want the upper tail.

  m = 100000; n = 15
  D = replicate(m,ks.test(scale(rnorm(n)),"pnorm")$statistic)
  quantile(D,p=1-c(.2,.15,.1,.05,.01))

Which gave:

      80%       85%       90%       95%       99% 
0.1810146 0.1898087 0.2014817 0.2193473 0.2550282 

Two more runs gave:

      80%       85%       90%       95%       99% 
0.1809712 0.1893494 0.2008654 0.2183181 0.2538759 
0.1813734 0.1902783 0.2018336 0.2198334 0.2546572 

So, taking something near the mean of those, to a rough approximation we have the following critical values at n=15

Level:   0.20  0.15  0.10  0.05  0.01
Crit.V: 0.181 0.190 0.201 0.219 0.255   

Lilliefors' tabulated values for n=15 are:

Level:  0.20  0.15  0.10  0.05  0.01
n=15:  0.177 0.187 0.201 0.220 0.257 

Aside from a bit more error on the 20% value and maybe the 15%, these are pretty close.

Now with the Anderson-Darling test that's a test for a fully-specified distribution, not an estimated one, so that's different. The test must be modified to act as an approximate test of general normality. See, for example, D'Agostino and Stephens' Goodness-of-Fit Techniques for some details on that. I don't think Anderson and Darling used simulation at all for their original test for a fully-specified distribution, but if you were to use it, you'd start by simulating uniforms (because that's the easiest case).

If you wanted the exact distribution of the modified statistic in the case of the normal, I think you'd simulate normals, internally standardize them again, and then compute the modified statistic and proceed using more or less the same sort of approach as above.

$\endgroup$
1
  • $\begingroup$ u r godsent! thank you so much! $\endgroup$
    – jojorabbit
    Nov 27, 2022 at 17:24

Your Answer

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

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