Creates simulated data from structural equation models with standardized loading.
Sometimes you have a structural model with standardized path
coefficients, structural coefficients, and correlations, but you do not
know the error and disturbance variances. The purpose of
is to calculate these variances and then simulate multivariate normal
data based on your model.
You can either install simstandard from CRAN or install the development version of simstandard from github.
You can install simstandard from CRAN by running this code:
To install the development version of simstandard, you need to check if devtools is installed. If not, run this:
Once you are sure you have devtools installed, you can install the development version of simstandard from GitHub by running this code:
simstandard package uses lavaan
syntax to specify models.
library(simstandard)model <- "A =~ 0.5 * A1 + 0.8 * A2B =~ 0.6 * B1 + 0.7 * B2B ~ 0.8 * AC ~~ 0.5 * A"data <- sim_standardized(m = model, n = 500)knitr::kable(head(data), digits = 2)
See more in the tutorial for this package.
matrix2lavaanfunction to provide a convenient method of creating lavaan syntax from matrices.
lav2ramfunction to extract standardized RAM matrices from a lavaan object.
sim_standardized_matricesfunction has a new argument,
composite_threshold. If this argument is specified, variables with loadings below the threshold are not used as indicators of the composite scores.
fixed2freefunction, which takes a
lavaansyntax model with fixed parameters and returns a
lavaansyntax model in which all parameters are free.
model_completefunction, which takes a
lavaansyntax model with standardized loadings, structure coefficients, and covariances, and returns a
lavaansyntax model with all standardized coefficients, including standardized variances.
add_factor_scoresfunction, which adds predicted factor scores to a data.frame.