Fundamentals of Statistics contains material of various lectures and courses of H. Lohninger on statistics, data analysis and here for more.

Shapiro-Wilk Test

The Shapiro-Wilk test is a test for normal distribution exhibiting high power, leading to good results even with a small number of observations. In contrast to other comparison tests the Shapiro-Wilk test is only applicable to check for normality.

The basis idea behind the Shapiro-Wilk test is to estimate the variance of the sample in two ways: (1) the regression line in the QQ-Plot allows to estimate the variance, and (2) the variance of the sample can also be regarded as an estimator of the population variance. Both estimated values should approximately equal in the case of a normal distribution and thus should result in a quotient of close to 1.0. If the quotient is significantly lower than 1.0 then the null hypothesis (of having a normal distribution) should be rejected.

In order to calculate the statistic W one has to perform the following procedure:

  1. The sample of size n (x1,x2,...xn) has to be sorted in increasing order, the resulting sorted sample will be designated by y1,y2,...yn (y1 < y2 < ... < yn).
  2. Calculate the sum
  3. a) if n is even, then b is calculated using mit k = n/2:

    b) if n is odd, b is calculated by using k=(n-1)/2, the median must not be included.
    The parameters an-i+1 depend on the sample size and have to be taken from a table published by Shapiro and Wilk
  4. Calculate the test statistic W = b2/S2
If the test statistic W is smaller than the critical threshold (see table below) the assumption of a normal distribution has to be rejected.

critical thresholds Wα
α=0.01  α=0.05     α=0.01  α=0.05 
5 0.6860.762  160.8440.887
60.7130.788  170.8510.892
70.7300.803  180.8580.897
80.7490.818  190.8630.901
90.7640.829  200.8680.905
100.7810.842  250.8880.918
110.7920.850  300.9000.927
120.8050.859  350.9100.934
130.8140.866  400.9190.940
140.8250.874  500.9300.947

Last Update: 2012-10-08