SWTest | R Documentation |
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.
SWTest(data, alpha = 0.05, j = 1, warn = T)
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) |
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.
An object including the test statistic, p-value, and a significance flag (list)
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
values <- rnorm(100) x <- SWTest(data = values)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.