sim_standardized {simstandard}R Documentation

Generates simulated data with standardized parameters.

Description

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

Usage

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

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)

[Package simstandard version 0.6.3 Index]