Learn R Programming

MVN (version 6.1)

royston: Royston's Multivariate Normality Test

Description

Performs Royston’s test for multivariate normality by combining univariate W-statistics (Shapiro–Wilk or Shapiro–Francia) across variables and adjusting for the correlation structure.

Usage

royston(data, tol = 1e-25, bootstrap = FALSE, B = 1000, cores = 1)

Value

A data frame with one row containing the test name (Test), the Royston test statistic (Statistic), and the associated p-value (p.value) from a chi-square approximation.

Arguments

data

A numeric matrix or data frame with observations in rows and variables in columns.

tol

Numeric tolerance passed to solve when inverting the covariance matrix. Default is 1e-25.

bootstrap

Logical; if TRUE, compute p-value via bootstrap resampling. Default is FALSE.

B

Integer; number of bootstrap replicates used when bootstrap = TRUE. Default is 1000.

cores

Integer; number of cores for parallel computation when bootstrap = TRUE. Default is 1.

Examples

Run this code
if (FALSE) {
data <- iris[1:50, 1:4]
royston_result <- royston(data)
royston_result
}

Run the code above in your browser using DataLab