SWTest: Shapiro-Wilk Test

View source: R/normal_Tests.R

SWTestR Documentation

Shapiro-Wilk Test

Description

This function is a wrapper for shapiro.test() from the stats package. Options added include an ability to toggle a Bonferonni correction for significance, a corresponding significance flag, and reorganized output to facilitate integration with the Rita package.

Usage

SWTest(data, alpha = 0.05, j = 1, warn = T)

Arguments

data

Data of a univariate distribution for which the test statistic is computed (vector)

alpha

The two-sided decision threshold used for hypothesis-testing

j

The # hypotheses tested; used to compute a Bonferonni correction, if applicable; should remain at its default if multiple testing is not an issue (scalar)

warn

Used for printing a warning message when resampling is performed on sample-sizes > 5000 or when testing is terminated for N < 3 (boolean)

Details

Note that when the sample-size of the input vector is > 5000, resampling with replacement is used to proceed with hypothesis-testing with a vector of 5000 elements. When N < 3, testing is terminated.

Value

An object including the test statistic, p-value, and a significance flag (list)

References

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

Patrick Royston (1982). Algorithm AS 181: The W test for Normality. Applied Statistics, 31, 176–180. 10.2307/2347986

Patrick Royston (1995). Remark AS R94: A remark on Algorithm AS 181: The W test for normality. Applied Statistics, 44, 547–551. 10.2307/2986146

Examples

values <- rnorm(100)
x <- SWTest(data = values)

Rita documentation built on March 18, 2022, 6:36 p.m.

Related to SWTest in Rita...