1. Home
2. WSTATISTIC procedure

# WSTATISTIC procedure

Calculates the Shapiro-Wilk test for Normality (R.W. Payne).

### Option

`PRINT` = string tokens What to print (`test`); default `test`

### Parameters

`DATA` = variates Samples of data to be tested for Normality Saves the Shapiro-Wilk W statistic for each sample Saves the probability for W under the assumption that the data are Normal

### Description

`WSTATISTIC` uses the Shapiro-Wilk test to assess whether a sample of data comes from a Normal distribution. The data values must be supplied, in a variate, using the `DATA` parameter. By default `WSTATISTIC` prints the statistic, W, with its probability value under the assumption that the data are Normal. (So a low probability indicates that the data are unlikely to be from a Normal distribution.) The printed output can be supressed by setting option `PRINT=*`. The test statistic can be saved, in a scalar, using the `W` parameter, and its probability can similarly be saved using the `PROBABILITY` parameter.

Option: `PRINT`.

Parameters: `DATA`, `W`, `PROBABILITY`.

### Method

`WSTATISTIC` calculates the statistic and its probability using the methods of Royston (1993, 1995).

### Action with `RESTRICT`

The `DATA` variate can be restricted to assess a subset of the data.

### References

Royston, P. (1993). A toolkit for testing for non-normality in complete and censored samples. The Statistician, 42, 37-43.

Royston, P. (1995). A remark on Algorithm AS 181: the W-test for Normality. Applied Statistics, 44, 547-551.

Directive: `DISTRIBUTION`.

Procedures: `EDFTEST`, `NORMTEST`.

Commands for: Basic and nonparametric statistics.

### Example

```CAPTION    'WSTATISTIC example','Data from Royston (1995)'; STYLE=meta,plain
VARIATE    [VALUES=4.2,4.9,5.2,5.3,6.7,6.7,7.2,7.5,8.1,8.6,8.8,9.3,\
9.5,10.3,10.8,11.1,12.2,12.5,13.3,15.1,15.3,16.1,19.0,19.5] Glucose
WSTATISTIC Glucose
```
Updated on October 30, 2020