sim_standardized: Generates simulated data with standardized parameters.

Description Usage Arguments Details Value Examples

View source: R/main.R

Description

This function takes a lavaan model with standardized parameters and simulates latent scores, errors, disturbances, and observed scores.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sim_standardized(
  m,
  n = 1000,
  observed = TRUE,
  latent = TRUE,
  errors = TRUE,
  factor_scores = FALSE,
  composites = FALSE,
  matrices = FALSE,
  ...
)

Arguments

m

Structural model represented by lavaan syntax

n

Number of simulated cases

observed

Include observed variables

latent

Include latent variables

errors

Include observed error and latent disturbances variables

factor_scores

Include factor score variables

composites

Include composite variables

matrices

Include matrices as attribute of tibble

...

Arguments passed to 'simstandardized_matrices'

Details

This function supports the '~' operator for regressions, the '~~' for covariances (but not variances), and the '=~' latent variable loadings. It does not support intercepts (e.g,. 'y ~ 1'), thresholds, scaling factors, formative factors, or equality constraints.

Value

tibble with standardized data

Examples

1
2
3
4
5
6
library(simstandard)
# Lavaan model
m = "Latent_1 =~ 0.8 * Ob_1 + 0.7 * Ob_2 + 0.4 * Ob_3"

# simulate 10 cases
sim_standardized(m, n = 10)

simstandard documentation built on May 8, 2021, 1:06 a.m.