| normtest | R Documentation |
Runs normality/distribution tests consistently for one or many variables, overall or within hierarchical groups.
normtest(x = NULL,
vars = NULL,
by = NULL,
data = NULL,
method = c("all",
"shapiro",
"ks",
"lilliefors",
"anderson",
"cramer.von.mises",
"shapiro.francia",
"pearson",
"jarque.bera"),
digits = 4,
p_digits = 3,
show = TRUE,
console = FALSE)
x |
One numeric variable. May be omitted when |
vars |
Optional |
by |
Optional grouping specification. With |
data |
Data frame; the active R4VN data frame is used when omitted. |
method |
Test or tests to run. |
digits, p_digits |
Decimal places for statistics and p-values. |
show, console |
R4VN display controls. |
Different normality tests have different sensitivities and sample-size behavior. The ordinary fitted-normal Kolmogorov-Smirnov p-value is approximate because mean and SD are estimated from the same sample; use the Lilliefors option when available. A nonsignificant test does not prove normality, so graphical inspection remains important.
An R4VN result object, invisibly.
swilk, varform
d <- data.frame(
x = rnorm(80),
y = rexp(80),
province = rep(c("A", "B"), each = 40),
sex = rep(rep(c("F", "M"), each = 20), 2)
)
normtest(x, data = d)
normtest(vars = vars(x, y), data = d, method = c("shapiro", "jarque.bera"))
normtest(vars = vars(x, y), by = vars(province, sex), data = d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.