sim_standardized: Generates simulated data with standardized parameters.

View source: R/main.R

sim_standardizedR 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)

wjschne/simstandard documentation built on April 13, 2024, 4:44 p.m.