Learn R Programming

MVN (version 6.1)

hz: Henze-Zirkler Test for Multivariate Normality

Description

Performs Henze and Zirkler's test to assess multivariate normality based on a log-normal approximation of the test statistic.

Usage

hz(
  data,
  use_population = TRUE,
  tol = 1e-25,
  bootstrap = FALSE,
  B = 1000,
  cores = 1
)

Value

A data frame with one row, containing the following columns: Test, the name of the test ("Henze-Zirkler"); HZ, the test statistic (numeric); and p.value, the p-value computed from a log-normal approximation.

Arguments

data

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

use_population

Logical; if TRUE, uses the population covariance estimator \(\frac{n-1}{n} \times \Sigma\); otherwise uses the sample covariance. Default is TRUE.

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]
hz_result <- hz(data)
hz_result
}

Run the code above in your browser using DataLab