genModelString: genModelString

View source: R/helperFunctions.R

genModelStringR Documentation

genModelString

Description

Creates lavaan model strings from model matrices.

Usage

genModelString(
  Lambda = NULL,
  Phi = NULL,
  Beta = NULL,
  Psi = NULL,
  Theta = NULL,
  tau = NULL,
  Alpha = NULL,
  useReferenceIndicator = !is.null(Beta),
  metricInvariance = NULL,
  nGroups = 1
)

Arguments

Lambda

Factor loading matrix.

Phi

Factor correlation (or covariance) matrix. If NULL, all factors are orthogonal.

Beta

Regression slopes between latent variables (all-y notation).

Psi

Variance-covariance matrix of latent residuals when Beta is specified. If NULL, a diagonal matrix is assumed.

Theta

Variance-covariance matrix of manifest residuals. If NULL and Lambda is not a square matrix, Theta is diagonal so that the manifest variances are 1. If NULL and Lambda is square, Theta is 0.

tau

Intercepts. If NULL and Alpha is set, these are assumed to be zero.

Alpha

Factor means. If NULL and tau is set, these are assumed to be zero.

useReferenceIndicator

Whether to identify factors in accompanying model strings by a reference indicator (TRUE) or by setting their variance to 1 (FALSE). When Beta is defined, a reference indicator is used by default, otherwise the variance approach.

metricInvariance

A list containing the factor indices for which the accompanying model strings should apply metric invariance labels, e.g. list(c(1, 2), c(3, 4)) to assume invariance for f1 and f2 as well as f3 and f4.

nGroups

(defaults to 1) If > 1 and metricInvariance = TRUE, group specific labels will be used in the measurement model.

Value

A list containing the following lavaan model strings:

modelPop

population model

modelTrue

"true" analysis model freely estimating all non-zero parameters.

modelTrueCFA

similar to modelTrue, but purely CFA based and thus omitting any regression relationships.


semPower documentation built on Sept. 30, 2024, 9:24 a.m.