This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

ShapiroWilkTest

ShapiroWilkTest[data]
tests whether data is normally distributed using the Shapiro-Wilk test.
ShapiroWilkTest
returns the value of .
  • ShapiroWilkTest performs the Shapiro-Wilk goodness-of-fit test with null hypothesis that data was drawn from a NormalDistribution and alternative hypothesis that it was not.
  • By default a probability value or -value is returned.
  • A small -value suggests that it is unlikely that the data came from dist.
  • The dist can be any symbolic distribution with numeric and symbolic parameters or a dataset.
  • The data can be univariate or multivariate .
  • The Shapiro-Wilk test effectively compares the order statistics of data to the theoretical order statistics of a NormalDistribution.
  • Properties related to the reporting of test results include:
"PValue"-value
"PValueTable"formatted version of
"ShortTestConclusion"a short description of the conclusion of a test
"TestConclusion"a description of the conclusion of a test
"TestData"test statistic and -value
"TestDataTable"formatted version of
"TestStatistic"test statistic
"TestStatisticTable"formatted
  • The following properties are independent of which test is being performed.
  • Properties related to the data distribution include:
"FittedDistribution"fitted distribution of data
"FittedDistributionParameters"distribution parameters of data
  • The following options can be given:
MethodAutomaticthe method to use for computing -values
SignificanceLevel0.05cutoff for diagnostics and reporting
  • For a test for goodness of fit, a cutoff is chosen such that is rejected only if . The value of used for the and properties is controlled by the SignificanceLevel option. By default is set to .
Perform a Shapiro-Wilk test for normality:
Perform a test for multivariate normality:
The full test table:
The test statistic and -value:
Perform a Shapiro-Wilk test for normality:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
 
Perform a test for multivariate normality:
In[1]:=
Click for copyable input
The full test table:
In[2]:=
Click for copyable input
Out[2]=
The test statistic and -value:
In[3]:=
Click for copyable input
Out[3]=
Perform a Shapiro-Wilk test for normality:
The -value for the normal data is large compared to the -value for the non-normal data:
Test for multivariate normality:
Create a HypothesisTestData object for repeated property extraction:
The properties available for extraction:
Tabulate the results of the Shapiro-Wilk test:
The full test table:
A -value table:
The test statistic:
Retrieve the entries from a Shapiro-Wilk test table for custom reporting:
Report test conclusions using and :
The conclusion may differ at a different significance level:
Use Monte Carlo-based methods or a computation formula:
Set the number of samples to use for Monte Carlo-based methods:
The Monte Carlo estimate converges to the true -value with increasing samples:
Set the random seed used in Monte Carlo-based methods:
The seed affects the state of the generator and has some effect on the resulting -value:
A power curve for the Shapiro-Wilk test:
Visualize the approximate power curve:
Estimate the power of the Shapiro-Wilk test when the underlying distribution is a CauchyDistribution, the test size is , and the sample size is 12:
The boiling point of water was measured at varying altitudes in the Alps. The barometric pressure was recorded for each boiling point. Determine if a linear model is appropriate for use in predicting boiling points given pressure:
A plot of the model and the data:
For the model to be appropriate, the residuals should be normally distributed:
A QuantilePlot confirms that the linear model is not appropriate for this data:
ShapiroWilkTest compares the order statistics of the data to their expectations under :
Expected values of the order statistics and an estimate of their covariance matrix:
These are used to compute weights:
The statistic using the estimated covariance matrix is slightly different from the reported value:
For tests of multivariate normality, a transformation to univariate data is made:
The data has been transformed to approximate univariate normal data:
Perform the test on the transformed data:
The result agrees with a test of the original data:
The Shapiro-Wilk test requires sample sizes be less than 5000 for -values to be valid:
The distribution of the Shapiro-Wilk test statistic:
New in 8