View source: R/normalityTest.R
normalityTest | R Documentation |
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
).
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, ...)
x |
numeric vector or formula. |
formula |
one-sided formula of the form |
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 |
gname |
optional name for the grouping factor; if absent, taken from |
... |
any arguments to be passed down; the only useful such arguments are for the
|
If testing by groups, the function invisibly returns NULL
; otherwise it returns an object of class
"htest"
, which normally would be printed.
John Fox jfox@mcmaster.ca
shapiro.test
, ad.test
, cvm.test
, lillie.test
,
pearson.test
, sf.test
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.