Statistics Definitions > Shapiro-Wilk Test
What is the Shapiro-Wilk Test?
The Shapiro-Wilk test is a way to tell if a random sample comes from a normal distribution. The test gives you a W value; small values indicate your sample is not normally distributed (you can reject the null hypothesis that your population is normally distributed if your values are under a certain threshold). The formula for the W value is:
xi are the ordered random sample values
ai are constants generated from the covariances, variances and means of the sample (size n) from a normally distributed sample.
How to Perform a Shapiro-Wilk Test
It’s rare that you’ll want to calculate the Shapiro-Wilk by hand. Many software packages can make the calculations for you:
- Click BASIC STATISTICS
- Choose NORMALITY TEST
- Type your data column in the VARIABLE BOX (do not fill in the reference
- Choose RYAN JOINER (this is the same as Shapiro-Wilk)
- Click OK
- R: Although not as popular as SPSS or Excel, R does have the ability to perform the test. The argument is very simple:
You can find more information about the argument here.
- SPSS: This article on Laerd.com shows how to perform the test in SPSS (it also incorporates the Kolmogorov-Smirnov test).
- Excel: This article has a very good outline of how to run the test in Excel for samples up to 5,000. There are also instructions on how to handle larger samples.
- MATLAB: Instructions for the test are given on the MathWorks site.
- SAS: The SAS support site has comprehensive instructions for a variety of Goodness of Fit tests. You can find the documentation here.
Tip: Use this test in combination with a normal probability plot.
If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.Comments are now closed for this post. Need help or want to post a correction? Please post a comment on our Facebook page and I'll do my best to help!