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.

## Installation

You can either install simstandard from CRAN or install the development version of simstandard from github.

### Option 1: Install the most recent stable release from CRAN

You can install simstandard from CRAN by running this code:

install.packages("simstandard")

### Option 2: Install the development version from GitHub

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

install.packages("remotes")

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

remotes::install_github("wjschne/simstandard")

## Example

The simstandard package uses lavaan syntax to specify models.

library(simstandard)
model <- "
A =~ 0.5 * A1 + 0.8 * A2
B =~ 0.6 * B1 + 0.7 * B2
B ~ 0.8 * A
C ~~ 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.18 0.84 1.67 1.75 2.22 0.80 1.47 -1.58 0.20 0.79 0.72 0.83
-0.06 -1.28 -0.15 -1.26 -0.78 -1.82 -2.02 0.85 0.17 1.07 0.16 -0.57
-0.49 -1.84 -0.59 -2.24 -1.89 -1.81 -1.24 0.41 -0.39 0.15 -1.37 0.21
-1.00 -1.02 1.31 1.02 -0.87 -0.56 -0.09 -0.72 -0.58 1.36 1.08 0.36
-0.54 -1.56 -0.86 -1.32 -0.58 -1.73 -1.44 0.32 -0.17 0.00 -0.31 -0.06
-0.46 2.09 0.11 1.45 1.83 1.38 0.75 -1.15 0.99 -0.34 0.92 -0.35

See more in the tutorial for this package.