pval_shapiro {DemographicTable}R Documentation

p-value from modified Shapiro-Wilk Normality Test

Description

Obtain p-value from shapiro.test, taking into consideration of several exceptions.

Usage

pval_shapiro(x, CLT = FALSE, ...)

Arguments

x

double vector

CLT

logical scalar, whether to allow the use of Central Limit Theorem, default FALSE

...

additional parameters, currently not in use

Details

Function pval_shapiro provides a pseudo p-value for several exceptions of shapiro.test, serving as a criteria of whether robust statistics/tests need to be used

length(x) < 3L

returns p=0, indicating that robust methods are needed.

length(x) > 5e3L

returns p=1, indicating that no robust method is needed. For such large sample size, robust methods could be too slow.

CLT & length(x) > 30L

returns p=1, indicating that no robust method is needed because of the use of Central Limit Theorem.

all x values are identical (or all.equal, to be implemented in future release)

returns p=0, indicating that robust methods are needed.

Otherwise

use the p-value from shapiro.test.

Value

Function pval_shapiro returns a double scalar.

Examples

pval_shapiro(rnorm(5))
sapply(with(airquality, split(Ozone, f = Month)), FUN = pval_shapiro)


[Package DemographicTable version 0.1.8 Index]