← Back to all sparks
M

modsem

INFRA · APIS
Velocity0.0

Latent Interaction (and Moderation) Analysis in Structural Equation Models (SEM)

modsem is grinding latent interaction models toward Mplus parity, one estimator at a time.

structural-equation-modelinglatent-interactionslms-estimatormplus-interopr-packages
Current state
modsem fits interaction and quadratic effects between latent variables in R, offering both product-indicator approaches (modsem_pi) and distribution-analytic ones (modsem_da, covering LMS and QML). Releases land roughly monthly and are dense pull-request lists. The recent line is dominated by the LMS approach: gradient refactors, parallel E-steps, composite construct support, and careful handling of residual covariances between latent variables.
Where it's heading
Two things are being closed at once. The modelling gap — composites and formative constructs, categorical estimators, residual covariances in every direction, multigroup and clustered designs — brings modsem toward what commercial Mplus users expect, and the package's Mplus bridge is maintained alongside it, now with unique file IDs and a cleanup argument. The performance gap is the other: memoised H0, parallel E-step, optimized gradients and Hessians for both LMS and QML, all aimed at the distribution-analytic estimators that are expensive by construction. Convention borrowing from lavaan continues in message formatting and standard-error defaults.
Prediction
The 1.0.20 and 1.0.21 releases both spent effort on residual covariances between endogenous and exogenous latent variables across estimation, prediction and standardization, and that thread has not obviously closed. The arrival of a second contributor moving MplusAutomation to Suggests suggests dependency trimming continues.

Recent moves

  1. 1mo ago

    Unique Mplus file IDs, cleanup argument, LMS gradient refactor

    Mostly consolidation of the Mplus bridge and the LMS internals. Unique IDs plus a cleanup argument make concurrent Mplus runs safe, sampling weights are correctly ordered under FIML, and MplusAutomation moves to Suggests so the dependency is optional. The package's first outside contributor appears here.

    View source ↗
  2. 2mo ago

    Composite constructs for LMS, plus MC-LMS-CAT and MC-QML-CAT

    The largest release in the window, and the one that widens specification most: composite and formative constructs work in both LMS and modsem_pi, two categorical Monte-Carlo estimators arrive, and residual covariances between exogenous and endogenous latent variables become expressible. The performance half — memoised H0, parallel E-step, optimized gradients for LMS and QML — is what makes the added specifications usable.

    View source ↗
  3. 3mo ago

    Print spacing and a partial-match fix in getSortedEtas()

    Two small corrections between larger releases: consistent spacing in the parameter table when loadings are not printed first, and prune partial matches no longer removed in getSortedEtas().

    View source ↗
  4. 4mo ago

    Categorical argument for Mplus; partial support for the <~ operator

    Two threads that recur later: the Mplus bridge gains a categorical argument, and the <~ formative operator gets partial support, prefiguring the full composite handling in 1.0.20. Plot and simple-slopes functions switch to a standardized vcov, which changes the intervals they draw.

    View source ↗
  5. 5mo ago

    Consistent three-way interaction estimates with rcs=TRUE

    The headline item is a correctness change rather than an addition: three-way interactions estimated with rcs=TRUE in modsem_pi now give consistent estimates. A seed argument for simulated par-tables and a type argument for plot_jn() round it out.

    View source ↗
  6. 6mo ago

    Secondary pruning and a forward-difference Hessian mode

    Efficiency work on the distribution-analytic path — secondary pruning, cheaper contribution calculation, and a pure forward-difference mode in fdHESS() — plus automatic handling of observed variables in modsem_da. Part of the long-running effort to make LMS and QML affordable on realistic models.

    View source ↗