Learn R Programming

DFA.CANCOR (version 0.2.8)

NORMALITY: Univariate and multivariate normality

Description

Produces tests of univariate and multivariate normality using the MVN package.

Usage

NORMALITY(data, groups, variables, verbose)

Value

If "groups" is not specified, the analyses will be run on all of the variables in "data". If "groups" is specified, the analyses will be run for every value of "groups". If "variables" is specified, the analyses will be run on the "variables" in "data". If verbose = TRUE, the displayed output includes descriptive statistics and tests of univariate and multivariate normality.

The returned output is a list with elements

descriptives

descriptive statistics, including skewness and kurtosis

Shapiro_Wilk

the Shapiro_Wilk test of univariate normality

Mardia

the Mardia test of multivariate normality

Henze_Zirkler

the Henze-Zirkler test of multivariate normality

Royston

the Royston test of multivariate normality

Doornik_Hansen

the Doornik_Hansen test of multivariate normality

Arguments

data

A dataframe where the rows are cases & the columns are the variables.

groups

(optional) The name of the groups variable in the dataframe,
e.g., groups = 'Group'.

variables

(optional) The names of the continuous variables in the dataframe for the analyses, e.g., variables = c('varA', 'varB', 'varC').

verbose

Should detailed results be displayed in the console?
The options are: TRUE (default) or FALSE.

Author

Brian P. O'Connor

References

Korkmaz, S., Goksuluk, D., Zararsiz, G. (2014). MVN: An R package for assessing multivariate normality. The R Journal, 6(2), 151-162.

Szekely,G. J., & Rizzo, M. L. (2017). The energy of data. Annual Review of Statistics and Its Application 4, 447-79.

Tabachnik, B. G., & Fidell, L. S. (2019). Using multivariate statistics (7th ed.). New York, NY: Pearson.

Examples

Run this code
# data that simulate those from De Leo & Wulfert (2013)
NORMALITY(data = na.omit(data_CANCOR$DeLeo_2013[c(
          'Unprotected_Sex','Tobacco_Use','Alcohol_Use','Illicit_Drug_Use',
          'Gambling_Behavior','CIAS_Total','Impulsivity','Social_Interaction_Anxiety',
          'Depression','Social_Support','Intolerance_of_Deviance','Family_Morals',
          'Family_Conflict','Grade_Point_Average')]))
 
# \donttest{
# data from Field et al. (2012)
NORMALITY(data = data_DFA$Field_2012, 
          groups = 'Group', 
          variables = c('Actions','Thoughts'))

# data from Tabachnik & Fidell (2013, p. 589)
NORMALITY(data = na.omit(data_CANCOR$TabFid_2019_small[c('TS','TC','BS','BC')]))

# UCLA dataset
UCLA_CCA_data <- read.csv("https://stats.idre.ucla.edu/stat/data/mmreg.csv")
colnames(UCLA_CCA_data) <- c("LocusControl", "SelfConcept", "Motivation",
                             "read", "write", "math", "science", "female")
summary(UCLA_CCA_data)
NORMALITY(data = na.omit(UCLA_CCA_data[c("LocusControl","SelfConcept","Motivation",
                                         "read","write","math","science")]))
# }

Run the code above in your browser using DataLab