Learn R Programming

MVTests (version 1.1)

mvShapiro: Multivariate Shapiro-Wilk Test for Multivariate Normality

Description

mvShapiro function tests whether the data set has multivariate normality distribution or not.

Usage

mvShapiro(data, group = FALSE, G = NULL)

Arguments

data

a data frame.

group

a logical argument. If group="TRUE", the normality tests are performed for the groups in data. When group=TRUE, G=NULL cannot be. default group="FALSE"

G

a group vector. default G=NULL

Value

a list with 2 elements:

Stat

The value of Test Statistic(s)

p.value

p value(s)

Details

This function computes the test statistic and p-value of the Shapiro-Wilk test for multivariate normality proposed by Villasenor-Alva and GonzalezEstrada (2009). Moreover, it can perform normality test for all groups in grouped datasets. The hypotheses are defined as H0:The dataset comes from multivariate normal distribution and H1:The dataset does not come from multivariate normal distribution.

References

Villasenor Alva, J. A., & Estrada, E. G. (2009). A generalization of Shapiro Wilk's test for multivariate normality. Communications in Statistics Theory and Methods, 38(11), 1870-1883.

Elizabeth Gonzalez Estrada and Jose A. Villasenor-Alva (2013). mvShapiroTest: Generalized Shapiro Wilk test for multivariate normality. R package version 1.0.

Examples

Run this code
# NOT RUN {
data(iris) 
# For raw data
result <- mvShapiro(data=iris[,1:4])
summary(result)
#For grouped data
result.group <- mvShapiro(data=iris[,1:4],group=TRUE,G=iris[,5])
summary(result.group)
# }

Run the code above in your browser using DataLab