Learn R Programming

MonteCarloSEM (version 2.0.0)

cov.mtx: Simulates Correlation matrix by a given SEM model.

Description

This function generates the model-implied covariance and correlation matrices based on a specified structural equation model (SEM). The function returns the implied covariance and correlation matrices.

Usage

cov.mtx(Model, nobs)

Value

Returns model implied covariance and correlation matrices.

Arguments

Model

A lavaan model object specifying the measurement and structural components of the SEM.

nobs

An integer indicating the number of observed indicators (xs) in the model.

Author

Fatih Orçan

Examples

Run this code
LavaanM <- '
# Measurement model (fixed factor loading)
F1 =~ 0.7*x1 + 0.7*x2 + 0.7*x3
F2 =~ 0.7*x4 + 0.7*x5 + 0.7*x6
F3 =~ 0.7*x7 + 0.7*x8 + 0.7*x9
# Structural regressions
F2 ~ 0.4*F1
F3 ~ 0.6*F1
# Fix latent variances
F1 ~~ 1*F1
# Residual variances
F2 ~~ 1*F2
F3 ~~ 1*F3
# Correlated residuals
F2 ~~ 0.5*F3
'

cov.mtx(Model=LavaanM, nobs=9)

Run the code above in your browser using DataLab