Learn R Programming

MVN (version 6.1)

test_univariate_normality: Univariate Normality Tests

Description

Performs one of several common univariate normality tests on each numeric variable in a vector, matrix, or data frame.

Usage

test_univariate_normality(data, test = c("SW", "CVM", "Lillie", "SF", "AD"))

Value

A data frame with one row per variable and the following columns: Test, the name of the test used; Variable, the name of the tested variable; Statistic, the test statistic; and p.value, the associated p-value.

Arguments

data

A numeric vector, matrix, or data frame with observations in rows and variables in columns. Non-numeric columns are dropped with a warning. Each column is tested individually.

test

A character string specifying the normality test to use. Choices are: "SW" (Shapiro–Wilk), "SF" (Shapiro–Francia), "AD" (Anderson–Darling), "CVM" (Cramér–von Mises), and "Lillie" (Lilliefors test). Default is the first match from this list.

Examples

Run this code
if (FALSE) {
data(iris)
test_univariate_normality(iris[, 1:4], test = "AD")
}

Run the code above in your browser using DataLab