Package: modsem 1.0.21

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

Estimation of interaction (i.e., moderation) effects between latent variables in structural equation models (SEM). The supported methods are: The constrained approach (Algina & Moulder, 2001). The unconstrained approach (Marsh et al., 2004). The residual centering approach (Little et al., 2006). The double centering approach (Lin et al., 2010). The latent moderated structural equations (LMS) approach (Klein & Moosbrugger, 2000). The quasi-maximum likelihood (QML) approach (Klein & Muthén, 2007) The constrained- unconstrained, residual- and double centering- approaches are estimated via 'lavaan' (Rosseel, 2012), whilst the LMS- and QML- approaches are estimated via 'modsem' it self. Alternatively model can be estimated via 'Mplus' (Muthén & Muthén, 1998-2017). References: Algina, J., & Moulder, B. C. (2001). <doi:10.1207/S15328007SEM0801_3>. "A note on estimating the Jöreskog-Yang model for latent variable interaction using 'LISREL' 8.3." Klein, A., & Moosbrugger, H. (2000). <doi:10.1007/BF02296338>. "Maximum likelihood estimation of latent interaction effects with the LMS method." Klein, A. G., & Muthén, B. O. (2007). <doi:10.1080/00273170701710205>. "Quasi-maximum likelihood estimation of structural equation models with multiple interaction and quadratic effects." Lin, G. C., Wen, Z., Marsh, H. W., & Lin, H. S. (2010). <doi:10.1080/10705511.2010.488999>. "Structural equation models of latent interactions: Clarification of orthogonalizing and double-mean-centering strategies." Little, T. D., Bovaird, J. A., & Widaman, K. F. (2006). <doi:10.1207/s15328007sem1304_1>. "On the merits of orthogonalizing powered and product terms: Implications for modeling interactions among latent variables." Marsh, H. W., Wen, Z., & Hau, K. T. (2004). <doi:10.1037/1082-989X.9.3.275>. "Structural equation models of latent interactions: evaluation of alternative estimation strategies and indicator construction." Muthén, L.K. and Muthén, B.O. (1998-2017). "'Mplus' User’s Guide. Eighth Edition." <https://www.statmodel.com/>. Rosseel Y (2012). <doi:10.18637/jss.v048.i02>. "'lavaan': An R Package for Structural Equation Modeling."

Authors:Kjell Solem Slupphaug [aut, cre], Mehmet Mehmetoglu [ctb], Matthias Mittner [ctb]

modsem_1.0.21.tar.gz
modsem_1.0.21.zip(r-4.7)modsem_1.0.21.zip(r-4.6)modsem_1.0.21.zip(r-4.5)
modsem_1.0.21.tgz(r-4.6-x86_64)modsem_1.0.21.tgz(r-4.6-arm64)modsem_1.0.21.tgz(r-4.5-x86_64)modsem_1.0.21.tgz(r-4.5-arm64)
modsem_1.0.21.tar.gz(r-4.7-arm64)modsem_1.0.21.tar.gz(r-4.7-x86_64)modsem_1.0.21.tar.gz(r-4.6-arm64)modsem_1.0.21.tar.gz(r-4.6-x86_64)
modsem_1.0.21.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION
card.svg |card.png
modsem/json (API)

# Install 'modsem' in R:
install.packages('modsem', repos = c('https://kss2k.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/kss2k/modsem/issues

Pkgdown/docs site:https://modsem.org

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library
Datasets:

On CRAN:

Conda:

interaction-effectinteraction-effectslatent-moderated-structural-equationslavaan-syntaxlmsmoderationqmlquasi-maximum-likelihoodrlangrlanguagesemstructural-equation-modelingstructural-equation-modelsopenblascppopenmp

10.07 score 9 stars 1 packages 162 scripts 1.3k downloads 36 exports 81 dependencies

Last updated from:bec8deb7cc. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK294
linux-devel-x86_64OK295
source / vignettesOK434
linux-release-arm64OK278
linux-release-x86_64OK271
macos-release-arm64OK191
macos-release-x86_64OK358
macos-oldrel-arm64OK189
macos-oldrel-x86_64OK521
windows-develOK320
windows-releaseOK279
windows-oldrelOK283
wasm-releaseOK216

Exports:bootstrap_modsemcentered_estimatescolorize_outputcompare_fitdefault_settings_dadefault_settings_piestimate_h0extract_lavaanfit_modsem_daget_pi_dataget_pi_syntaxis_interaction_modelmodsemmodsem_coefmodsem_damodsem_inspectmodsem_mimputemodsem_mplusmodsem_nobsmodsem_pimodsem_predictmodsem_vcovmodsemifyparameter_estimatesplot_interactionplot_jnplot_surfacerelcorr_single_itemset_modsem_colorssimple_slopesstandardize_modelstandardized_estimatessummarize_partabletrace_pathtwostepvar_interactions

Dependencies:Ameliaaskpassbase64encBHbslibcachemclicpp11crosstalkcurldata.tableDerivdigestdplyrevaluatefarverfastGHQuadfastmapfontawesomeforeignfsgenericsggplot2gluegtablehighrhtmltoolshtmlwidgetshttrisobandjquerylibjsonliteknitrlabelinglaterlatticelavaanlazyevallifecyclemagrittrMASSmemoisemimemnormtmvnfastmvtnormnlmenumDerivopensslotelpbivnormpillarpkgconfigplotlypromisespurrrquadprogR6rappdirsRColorBrewerRcppRcppArmadilloRhpcBLASctlrlangrmarkdownS7sassscalesstringistringrsystibbletidyrtidyselecttinytexutf8vctrsviridisLitewithrxfunyaml

interactions with ordered data
Example

Last update: 2026-05-20
Started: 2026-05-20

composite constructs
Composite Constructs

Last update: 2026-05-15
Started: 2026-05-14

observed variables in the LMS- and QML approach
The Latent Moderated Structural Equations (LMS) and the Quasi Maximum Likelihood (QML) Approach | The LMS Approach | The QML Approach

Last update: 2026-01-18
Started: 2024-06-22

customizing the output from plot_interaction()
Baseline Plot | Changing Titles and Labels | Title | Axis Labels | Legend Title | Changing Colors | Greyscale | Brewer Color palettes | Custom Color Palettes | Changing Line types | Combinations

Last update: 2025-11-07
Started: 2025-11-07

LMS and QML approaches
The Latent Moderated Structural Equations (LMS) and the Quasi Maximum Likelihood (QML) Approach | A Simple Example | A More Complicated Example

Last update: 2025-11-07
Started: 2024-05-31

plotting interaction effects
Plotting Interaction Effects | Plotting Johnson-Neyman Regions | Plotting (3D) Surface Plots | Quadratic Effects and Response Surface Models | Generating Data | Fitting Model | 2D Plot | 3D (Response Surface) Plot

Last update: 2025-09-12
Started: 2024-06-01

higher order interactions
LMS approach | Interaction between two higher order latent variables | Interaction between a first order and a higher order latent variable | Product Indicator Approaches

Last update: 2025-09-11
Started: 2024-11-03

missing data in the LMS and QML approaches
Options for Handling Missing Values | Full Information Maximum Likelihood (FIML) | (Multiple) Imputation

Last update: 2025-08-12
Started: 2025-08-10

quadratic effects
Quadratic Effects and Interaction Effects

Last update: 2025-08-10
Started: 2024-05-31

customizing interaction terms
Specifying the Measurement Model | More Complicated Models

Last update: 2025-07-25
Started: 2024-05-31

estimation alternatives using the LMS approach
Accelerated EM and Adaptive Quadrature

Last update: 2025-07-25
Started: 2025-06-06

fit measures for LMS and QML
Introduction | Example | Fit measures baseline model | Difference Test of Fit | Inspecting Fit Indices | References

Last update: 2025-07-25
Started: 2025-04-25

interaction effects between endogenous variables
The Problem | The Solution | Example

Last update: 2025-07-25
Started: 2024-06-04

methods
Product Indicator (PI) Approaches: | Distribution Analytic (DA) Approaches

Last update: 2025-07-25
Started: 2024-05-31

modsem
The Basic Syntax | A Simple Example | Interactions Between Two Observed Variables | Using a Regression | Using modsem | Interactions Between Latent and Observed Variables | Quadratic Effects | More Complicated Examples

Last update: 2025-07-25
Started: 2024-05-31

non-centered interaction terms (LMS and QML)
Non-centered interaction terms

Last update: 2025-07-25
Started: 2025-06-21

reliability-corrected single items
Reliablity-Corrected Single Items | Choosing Variables

Last update: 2025-07-25
Started: 2025-06-16

simple slopes analysis
Simple Slopes Analysis

Last update: 2025-07-25
Started: 2025-01-07

using lavaan functions

Last update: 2025-07-25
Started: 2024-05-31

Readme and manuals

Help Manual

Help pageTopics
Bootstrap a modsem Modelbootstrap_modsem bootstrap_modsem.function bootstrap_modsem.modsem_da bootstrap_modsem.modsem_pi
Get Centered Interaction Term Estimatescentered_estimates centered_estimates.lavaan centered_estimates.modsem_da
Capture, colorise, and emit console textcolorize_output
compare model fit for 'modsem' modelscompare_fit
default arguments fro LMS and QML approachdefault_settings_da
default arguments for product indicator approachesdefault_settings_pi
Estimate baseline model for 'modsem' modelsestimate_h0 estimate_h0.modsem_da estimate_h0.modsem_pi
extract lavaan object from modsem object estimated using product indicatorsextract_lavaan
Fit measures for QML and LMS modelsfit_modsem_da
Get data with product indicators for different approachesget_pi_data
Get 'lavaan' syntax for product indicator approachesget_pi_syntax
Check if model object has interaction termsis_interaction_model
Jordan subset of PISA 2006 datajordan
Estimate interaction effects in structural equation models (SEMs)modsem
Wrapper for coefmodsem_coef
Interaction between latent variables using LMS and QML approachesmodsem_da
Inspect model informationmodsem_inspect modsem_inspect.lavaan modsem_inspect.modsem_da modsem_inspect.modsem_pi
Estimate a 'modsem' model using multiple imputationmodsem_mimpute
Estimation latent interactions through 'Mplus'modsem_mplus
Wrapper for nobsmodsem_nobs
Interaction between latent variables using product indicatorsmodsem_pi
Predict From 'modsem' Modelsmodsem_predict modsem_predict.modsem_da modsem_predict.modsem_pi
Wrapper for vcovmodsem_vcov
Generate parameter table for 'lavaan' syntaxmodsemify
oneIntoneInt
Extract parameterEstimates from an estimated modelparameter_estimates parameter_estimates.lavaan parameter_estimates.modsem_da parameter_estimates.modsem_mplus parameter_estimates.modsem_pi
Plot Interaction Effects in a SEM Modelplot_interaction
Plot Interaction Effect Using the Johnson-Neyman Techniqueplot_jn
Plot Surface for Interaction Effectsplot_surface
Reliability‑Corrected Single‑Item SEMrelcorr_single_item
Define or disable the color theme used by 'modsem'set_modsem_colors
Get the simple slopes of a SEM modelsimple_slopes
Standardize a fitted 'modsem_da' modelstandardize_model
Get Standardized Estimatesstandardized_estimates standardized_estimates.lavaan standardized_estimates.modsem_da standardized_estimates.modsem_mplus standardized_estimates.modsem_pi
Summarize a parameter table from a 'modsem' model.summarize_partable
summary for modsem objectssummary.modsem_da summary.modsem_mplus summary.modsem_pi
TPBTPB
TPB_1SOTPB_1SO
TPB_2SOTPB_2SO
TPB_UKTPB_UK
Estimate formulas for (co-)variance paths using Wright's path tracing rulestrace_path
Estimate interaction effects in structural equation models (SEMs) using a twostep proceduretwostep
Extract or modify parTable from an estimated model with estimated variances of interaction termsvar_interactions