Learn R Programming

onewaytests (version 3.0)

nor.test: Normality Tests

Description

nor.test performs normality tests including Shapiro-Wilk, Shapiro-Francia, Kolmogorov-Smirnov, Anderson-Darling, Cramer-von Mises, Pearson Chi-square tests, and also assess the normality of each group through plots.

Usage

nor.test(formula, data, method = c("SW", "SF", "LT", "AD", "CVM", "PT"), 
  alpha = 0.05, plot = c("qqplot-histogram", "qqplot", "histogram"), mfrow = NULL, 
  na.rm = TRUE, verbose = TRUE)

Value

A data frame gives the test results for the normality of groups via corresponding normality.

Arguments

formula

a formula of the form lhs ~ rhs where lhs gives the sample values and rhs the corresponding groups.

data

a tibble or data frame containing the variables in formula.

method

a character string to select one of the normality tests. "SW": Shapiro-Wilk test, "SF": Shapiro-Francia test, "LT": Lilliefors (Kolmogorov-Smirnov) test, "AD": Anderson-Darling test, "CVM": Cramer-von Mises test, "PT": Pearson Chi-square test.

alpha

the level of significance to assess normality. Default is set to alpha = 0.05.

plot

a character string to select one of the plots including qqplot-histogram, qqplot, histogram. The red line is the density line of normal distribution.

mfrow

a two element vector to draw subsequent figures.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

verbose

a logical for printing output to R console.

Author

Osman Dag

See Also

homog.test gplot shapiro.test

Examples

Run this code

library(onewaytests)

nor.test(Sepal.Length ~ Species, data = iris, method = "SW", plot = "qqplot-histogram")
nor.test(Sepal.Length ~ Species, data = iris, method = "SF", plot = "qqplot", mfrow = c(1,3))

Run the code above in your browser using DataLab