simstandard


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)
A1A2B1B2CABe_A1e_A2e_B1e_B2d_B
-1.31-1.03-0.80-0.971.08-0.110.55-1.26-0.94-1.13-1.350.63
0.381.240.640.75-0.730.001.200.381.24-0.08-0.081.20
-0.83-0.552.121.21-0.250.121.02-0.88-0.651.510.500.93
1.13-0.231.511.400.920.401.310.93-0.550.730.480.99
0.90-0.62-0.85-0.28-0.30-0.19-0.430.99-0.47-0.600.02-0.28
0.050.630.901.141.030.460.76-0.180.260.450.610.39

See more in the tutorial for this package.

Copy Link

Version

Down Chevron

Install

install.packages('simstandard')

Monthly Downloads

402

Version

0.6.3

License

CC0

Issues

Pull Requests

Stars

Forks

Last Published

May 7th, 2021

Functions in simstandard (0.6.3)