Regression - Diagnostic - Test Residual Normality (Shapiro-Wilk)

From Q
Jump to navigation Jump to search


Conducts the Shapiro-Wilk test of normality on the (deviance) residuals of a Regression output.

Example

An example output appears below.

Technical details

A small p-value indicates a departure from normality. For large samples, a departure from normality will almost always be detected.

The test is performed on the deviance residuals in a model, which are automatically extracted from a model using resid. For more information on the use of residuals in regression modeling, see this blog post.

Acknowledgements

Uses the R function shapiro.test in the stats package.

References

Shapiro, S. S.; Wilk, M. B. (1965). "An analysis of variance test for normality (complete samples)". Biometrika. 52 (3–4): 591–611. DOI: 10.1093/biomet/52.3-4.591.

Royston, P. (1982). An extension of Shapiro and Wilk's W test for normality to large samples. Applied Statistics. 31: 115-124. DOI: 10.2307/2347973.

Code

includeWeb("QScript R Output Functions");

const menu_location = "Regression > Diagnostic > " +
      "Test Residual Normality (Shapiro-Wilk)";
createDiagnosticROutputFromSelection(menu_location);