# Discnorm: Testing for underlying normality in ordinal datasets

#### 2020-05-13

library(discnorm )

The discnorm package uses bootstrapping to help determine whether the commonly assumed normality assumption is tenable for an ordinal dataset. Researchers wanting to proceed with ordinal SEM based on polychoric correlations need first to check that the normality assumption is not violated.

The procedure is fully described in Foldnes and Grønneberg (2019)

## Examples

The procedure is named bootTest() and operates on an ordinal dataset and returns a p-value associated with the null-hypothesis of underlying normality. Let us first use the test for a dataset that is produced by underlying normality.

#let us discretize an underlying normal vector
# with moderate correlation
rho <- 0.3
Sigma <- diag(5)
Sigma[Sigma !=1] <- rho
set.seed(1234)
norm.sample  <- MASS::mvrnorm(n=200, mu=rep(0,5), Sigma=Sigma)
# let us discretize into 4 categories
disc.sample <- apply(norm.sample, 2, cut,   breaks=c(-Inf, -1, 1, 2, Inf), labels=FALSE)

#check for underlying normality
pvalue <- bootTest(disc.sample, B=500)
#> Progress 0% 20% 40% 60% 80% 100%
print(pvalue)
#> [1] 0.906
# we have no evidence against the null hypothesis of underlying normality

And let us discretize a non-normal dataset

nonnorm.sample <- data.frame(norm.sample[, 1:4], norm.sample[,1]*norm.sample[,2])
disc.sample2 <- apply(nonnorm.sample, 2, cut, breaks=c(-Inf, -1, 1, 2, Inf), labels=FALSE)
pvalue <- bootTest(disc.sample2, B=500)
#> Progress 0% 20% 40% 60% 80% 100%
print(pvalue)
#> [1] 0
# rejected!

## References

Foldnes, N, and S Grønneberg. 2019. “Pernicious Polychorics: The Impact and Detection of Underlying Non-Normality.” Structural Equation Modeling: A Multidisciplinary Journal. Taylor & Francis.