Learn R Programming

RcmdrMisc (version 2.10.2)

normalityTest: Normality Tests

Description

Normality Tests

Usage

normalityTest(x, ...)

# S3 method for formula normalityTest(formula, test, data, ...)

# S3 method for default normalityTest( x, test = c("shapiro.test", "ad.test", "cvm.test", "lillie.test", "pearson.test", "sf.test"), groups, vname, gname, ... )

Value

If testing by groups, the function invisibly returns NULL; otherwise it returns an object of class "htest", which normally would be printed.

Arguments

x

numeric vector or formula.

...

any arguments to be passed down; the only useful such arguments are for the pearson.test function in the nortest package.

formula

one-sided formula of the form ~x or two-sided formula of the form x ~ groups, where x is a numeric variable and groups is a factor.

test

quoted name of the function to perform the test.

data

a data frame containing the data for the test.

groups

optional factor to divide the data into groups.

vname

optional name for the variable; if absent, taken from x.

gname

optional name for the grouping factor; if absent, taken from groups.

Author

John Fox

Details

Perform one of several tests of normality, either for a variable or for a variable by groups. The normalityTest function uses the shapiro.test function or one of several functions in the nortest package. If tests are done by groups, then adjusted p-values, computed by the Holm method, are also reported (see p.adjust).

See Also

shapiro.test, ad.test, cvm.test, lillie.test, pearson.test, sf.test.

Examples

Run this code
data(Prestige, package="car")
with(Prestige, normalityTest(income))
normalityTest(income ~ type, data=Prestige, test="ad.test")
normalityTest(~income, data=Prestige, test="pearson.test", n.classes=5)

Run the code above in your browser using DataLab