# Solved – How to calculate critical values (\$W_{alpha}\$) for the Shapiro-Wilk test

When performing the Shapiro-Wilk test, we can obtain the critical \$W_{alpha}\$ statistic from tables, given \$alpha\$ is 0.05 or 0.01.

If \$alpha\$ is nonstandard, say 0.07 or 0.02 for example, how we can calculate the value of \$W_{alpha}\$?

Contents

I think you're asking how to calculate a critical value for the Shapiro-Wilk test at significance levels other than the usual tabulated ones (I mention this because it's possible you're really interested in how to compute a p-value, which is a closely related issue, though now Chris and I have edited your question, my doubt looks a bit odd.)

If your desired significance level is between tabulated ones, such as wanting 2% and having 5% and 1%, you could use interpolation, which will at least be approximately suitable. It looks to me like \$Phi(1-p)\$ is close to linear* in \$log(n(1-W))\$ for \$nge 12\$, and even down at \$n=5\$ it's locally close enough that linear interpolation should work fine if done on those scales.

More generally, computer software is the most obvious choice. Some software offers direct calculation of p-values for the Shapiro-Wilk that may avoid the need to use critical values at all.

Finally, simulation is an option; one can simulate the statistic and hence obtain simulations from the distribution under the null; this allows one to compute estimates of quantiles of the distribution.

* Edit: looking at the p-value code in R, that shift in nearness-to-linearity between n=11 and n=12 is because R is using a different approximation to compute p-values for \$n\$ below 12; that shouldn't affect the suitability of linear interpolation at say 12, but it does suggest to me that it appearing to be very close to linear is more that the approximation is close to linear for \$nge 12\$; the actual transformed distribution is probably somewhat less linear down that low. [Now I look, the help even gives the information that a different approximation is used below 12.]

R also offers the following references, in case you want to write your own code:

[1] Patrick Royston (1982) An extension of Shapiro and Wilk's W test for normality to large samples. Applied Statistics, 31, 115-124.

[2] Patrick Royston (1982) Algorithm AS 181: The W test for Normality. Applied Statistics, 31, 176-180.

[3] Patrick Royston (1995) Remark AS R94: A remark on Algorithm AS 181: The W test for normality. Applied Statistics, 44, 547-551.

Rate this post