Creates simulated data from structural equation models with standardized loading. Data generation methods are described in Schneider (2013)

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 `simstandard`

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:

install.packages("simstandard")

To install the development version of simstandard, you need to check if devtools is installed. If not, run this:

install.packages("devtools")

Once you are sure you have devtools installed, you can install the development version of simstandard from GitHub by running this code:

devtools::install_github("wjschne/simstandard")

The `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)

A1 | A2 | B1 | B2 | C | A | B | e_A1 | e_A2 | e_B1 | e_B2 | d_B |
---|---|---|---|---|---|---|---|---|---|---|---|

-1.22 | 0.58 | 1.08 | 1.43 | 0.48 | -0.49 | 0.12 | -0.97 | 0.97 | 1.00 | 1.35 | 0.51 |

-0.53 | 0.52 | 0.66 | 0.40 | -0.76 | 1.77 | 0.41 | -1.41 | -0.90 | 0.41 | 0.11 | -1.00 |

-0.08 | 0.35 | 1.21 | 2.25 | 0.27 | 0.44 | 0.65 | -0.30 | 0.00 | 0.82 | 1.80 | 0.30 |

1.23 | 0.06 | -2.34 | -1.45 | 0.16 | 0.39 | -0.63 | 1.04 | -0.26 | -1.96 | -1.00 | -0.95 |

-0.38 | -0.86 | -0.66 | -2.23 | -0.96 | -1.69 | -1.48 | 0.47 | 0.50 | 0.23 | -1.19 | -0.12 |

0.63 | 0.55 | -0.65 | -0.56 | -0.02 | 0.22 | -0.12 | 0.51 | 0.38 | -0.58 | -0.47 | -0.30 |

See more in the tutorial for this package.

- Added the
`matrix2lavaan`

function to provide a convenient method of creating lavaan syntax from matrices. - Added the
`lav2ram`

function to extract standardized RAM matrices from a lavaan object. - The
`sim_standardized_matrices`

function 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. - Removed the semPlot package from suggests list

- Fixed the method of finding indicators for composite variables. A composite now is only created from direct indicators unless the latent variable is a higher-order factor with no direct indicators.

- Added the
`fixed2free`

function, which takes a`lavaan`

syntax model with fixed parameters and returns a`lavaan`

syntax model in which all parameters are free. - Added the
`model_complete`

function, which takes a`lavaan`

syntax model with standardized loadings, structure coefficients, and covariances, and returns a`lavaan`

syntax model with all standardized coefficients, including standardized variances. - Added the
`add_factor_scores`

function, which adds predicted factor scores to a data.frame.

- Initial release