Learn R Programming

DemographicTable (version 0.2.1)

pval_shapiro: \(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, ...)

Value

Function pval_shapiro() returns a double scalar.

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.

Examples

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

Run the code above in your browser using DataLab