Skip to content

Example 10: Nonnormal Factor Distribution (Version 0.2)

psunthud edited this page Dec 30, 2012 · 2 revisions

Model Description

This example will also show how to create nonnormal distribution. Instead of generating data directly from model-implied means and covariance matrix of observed indicators, this example uses a different approach, which will be referred as sequential method. This sequential method will generate all exogenous factors first, then endogenous factors, and then measurement errors. After that, the factor scores and error scores are combined together to get the observed scores. This sequential method will allow us to pinpoint the part inside the model that are not normally distributed. This example will show nonnormal exogenous factors. The nonnormality model can be built by the Gaussian copula approach.

We will consider a SEM model with four factors and three indicators each. The first two factors are exogenous and influence the fourth factor. The third factor fully mediates the direct effect from the first two factors to the fourth factor. The correlation between the first and the second factors ranges from -0.5 to 0.5 in uniform distribution. The effect from the first two factors to the third factors ranges from 0.3 to 0.5 in uniform distribution. The effect from the third factor to the fourth factor ranges from 0.5 to 0.7 in uniform distribution. All exogenous factor variances are 1 and all error variances of endogenous factors are equal to the value that makes overall factor variances equal to 1. The factor loadings range from 0.7 to 0.9 in uniform distribution. The measurement variance will be made so that overall indicators variances equal to 1.

There are three types of misspecification imposed here. First, the cross loadings ranges from -0.3 to 0.3 in uniform distribution. Second, the error correlations range in normal distribution with the mean of 0 and standard deviation of 0.1. Third, the direct effects are ranged from -0.1 to 0.1 in uniform distribution. The marginal distributions of the exogenous factors are chi-squared distribution with the degree of freedom of 5. The distributions of residuals of endogenous factors are normally distributed.

Example 10 Model

Syntax

All relevant distribution objects are specified:

u35 <- simUnif(0.3, 0.5)
u57 <- simUnif(0.5, 0.7)
u1 <- simUnif(-0.1, 0.1)
u3 <- simUnif(-0.3, 0.3)
n1 <- simNorm(0, 0.1)
n31 <- simNorm(0.3, 0.1)
u79 <- simUnif(0.7, 0.9)
chi5 <- simChisq(5)

The parameter model is specified:

path.BE <- matrix(0, 4, 4)
path.BE[3, 1:2] <- NA
path.BE[4, 3] <- NA
starting.BE <- matrix("", 4, 4)
starting.BE[3, 1:2] <- "u35"
starting.BE[4, 3] <- "u57"
BE <- simMatrix(path.BE, starting.BE)
  
residual.error <- diag(4)
residual.error[1,2] <- residual.error[2,1] <- NA
RPS <- symMatrix(residual.error, "n31")
  
loading <- matrix(0, 12, 4)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loading[7:9, 3] <- NA
loading[10:12, 4] <- NA
LY <- simMatrix(loading, "u79")
  
RTE <- symMatrix(diag(12))
  
SEM.Model <- simSetSEM(RPS = RPS, BE = BE, LY = LY, RTE = RTE)

Trivial model misspecification is specified:

mis.path.BE <- matrix(0, 4, 4)
mis.path.BE[4, 1:2] <- NA
  
mis.BE <- simMatrix(mis.path.BE, "u1")
mis.loading <- matrix(NA, 12, 4)
mis.loading[is.na(loading)] <- 0
mis.LY <- simMatrix(mis.loading, "u3")
  
mis.error.cor <- matrix(NA, 12, 12)
diag(mis.error.cor) <- 0
mis.RTE <- symMatrix(mis.error.cor, "n1")
  
SEM.Mis.Model <- simMisspecSEM(BE = mis.BE, LY = mis.LY, RTE = mis.RTE)

Next, we need to specify the distribution of factors. Again, we use a data distribution object to model the factor distributions. We create only four distribution objects to represent the distribution of four factors.

facDist <- simDataDist(chi5, chi5, n1, n1)

Because Factors 1 and 2, Factor 3, and Factor 4 are in the different parts of the regression chain in sequential data generation, the multivariate distribution of the first two factors will be built first. In this case Factor 1 and 2's marginal distributions are chi-squared distributed. Then, the residual from Factor 3 is generated, which is normally distributed, and is combined with the predicted score from the first two factors. Finally, the normal residual from Factor 4 is generated and is combined with the predicted score from the other factors.

The data object is specified:

dataTemplate <- simData(SEM.Model, 500, SEM.Mis.Model, sequential=TRUE, facDist=facDist)

There are two additional arguments. The sequential argument is to use the sequential method of data generation. The facDist argument is to put the factor distribution objects.

The model object is specified:

SimModel <- simModel(CFA.Model, estimator="mlr")

"mlr" is the maximum likelihood estimator with robust Huber-White standard error with Yuan-Bentler T2 scaled test statistic.

The result object can be specified and investigated:

simOut <- simResult(1000, dataTemplate, modelTemplate)
getCutoff(simOut, 0.05)
plotCutoff(simOut, 0.05)
summaryParam(simOut)

The figure below shows the graph provided by the plotCutoff function:

Example 10 SSD

Here is the summary of the whole script in this example.

Remarks

Regression Residual Distributions

The regression residual could be nonnormally distributed. For example, the residual distribution of the third and the fourth factors are reversed chi-squared distributions with degrees of freedom of 10. The syntax in Line 42 can be changed:

chi10 <- simChisq(10)
facDist <- simDataDist(chi5, chi5, chi10, chi10, reverse=c(F, F, T, T))

Measurement Error Distributions

The measurement error could be nonnormally distributed as well. For example, the measurement errors are a t-distribution with 10 degrees of freedom. The syntax in Line 42-43 can be changed:

t10 <- simT(10)
facDist <- simDataDist(chi5, chi5, n1, n1)
errorDist <- simDataDist(t10, p=12)
dataTemplate <- simData(SEM.Model, 500, SEM.Mis.Model, sequential=TRUE, facDist=facDist, errorDist=errorDist)

The data distribution object representing the measurement error distribution is added to the errorDist argument of the constructor of data object.

Clone this wiki locally