normalityTest: Normality Tests

View source: R/normalityTest.R

normalityTestR Documentation

Normality Tests

Description

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).

Usage

normalityTest(x, ...)

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

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

Arguments

x

numeric vector or formula.

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.

data

a data frame containing the data for the test.

test

quoted name of the function to perform 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.

...

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

Value

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

Author(s)

John Fox jfox@mcmaster.ca

See Also

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

Examples

  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)

RcmdrMisc documentation built on Sept. 27, 2023, 1:06 a.m.