generate_mplus_besem_syntax: Generate Mplus B-ESEM Syntax

View source: R/bifactor.R

generate_mplus_besem_syntaxR Documentation

Generate Mplus B-ESEM Syntax

Description

Generates the correct Mplus syntax for Bifactor ESEM with orthogonal target rotation, using separate BY statements per factor with (*1).

Usage

generate_mplus_besem_syntax(
  specific_factors,
  all_indicators,
  g_name = "G",
  cfa_factors = NULL,
  regressions = NULL,
  covariances = NULL,
  data_file = "mydata.dat",
  missing_code = 999,
  output_path = NULL,
  ordered = FALSE,
  estimator = if (ordered) "WLSMV" else "MLR"
)

Arguments

specific_factors

Named list of specific factor -> item assignments.

all_indicators

Character vector of all ESEM indicator names.

g_name

Character. General factor name. Default "G".

cfa_factors

Optional named list of additional CFA factors.

regressions

Optional character vector of regression statements.

covariances

Optional character vector of covariance statements.

data_file

Character. Data file name. Default "mydata.dat".

missing_code

Missing value code. Default 999. Use "." for files written by MplusAutomation::prepareMplusData(), which writes MISSING = .;.

output_path

Character. Path to write .inp file. Returns syntax invisibly if NULL.

ordered

Logical. TRUE declares the indicators CATEGORICAL and keeps Mplus's default delta parameterization, the model besem_ordered fits: residual variances are one minus the communality, so Mplus reports a negative one (Heywood case) where the theta parameterization would not. Default FALSE.

estimator

Character. Default "WLSMV" when ordered = TRUE, otherwise "MLR".

Value

Mplus syntax string (invisibly). Writes file if output_path supplied.


bifactory documentation built on Oct. 28, 2026, 1:06 a.m.