
SEMinR allows users to easily create and modify structural equation models (SEM). It allows estimation using either covariance-based SEM (CBSEM, such as LISREL/Lavaan), or Partial Least Squares Path Modeling (PLS-PM, such as SmartPLS/semPLS).
SEMinR speaks your language. Beyond the original R package,
SEMinR is being ported to Python and TypeScript — both are
experimental for now and validated against the R base for
numerical parity. See the Packages page to get started.
Main features of using SEMinR:
Take a look at the easy syntax and modular design — the same model, in whichever language you prefer:
# Define measurements with familiar terms: reflective, composite, multi-item constructs, etc.
measurements <- constructs(
reflective("Image", multi_items("IMAG", 1:5)),
composite("Expectation", multi_items("CUEX", 1:3)),
composite("Loyalty", multi_items("CUSL", 1:3), weights = mode_B),
composite("Complaints", single_item("CUSCO"))
)
# Create four relationships (two regressions) in one line!
structure <- relationships(
paths(from = c("Image", "Expectation"), to = c("Complaints", "Loyalty"))
)
# Estimate the model with PLS (Consistent PLS for the reflective construct)
pls_model <- estimate_pls(data = mobi, measurements, structure)
# Re-estimate the same model as purely reflective using CBSEM
cbsem_model <- estimate_cbsem(data = mobi, as.reflective(measurements), structure)from seminr import (
constructs, reflective, composite, multi_items, single_item, mode_B,
relationships, paths, estimate_pls, estimate_cbsem, as_reflective,
)
from seminr.datasets import load_mobi
mobi = load_mobi()
# Define measurements with familiar terms: reflective, composite, multi-item constructs, etc.
measurements = constructs(
reflective("Image", multi_items("IMAG", [1, 2, 3, 4, 5])),
composite("Expectation", multi_items("CUEX", [1, 2, 3])),
composite("Loyalty", multi_items("CUSL", [1, 2, 3]), weights=mode_B),
composite("Complaints", single_item("CUSCO")),
)
# Create four relationships (two regressions) in one line!
structure = relationships(
paths(["Image", "Expectation"], ["Complaints", "Loyalty"]),
)
# Estimate the model with PLS (Consistent PLS for the reflective construct)
pls_model = estimate_pls(mobi, measurements, structure)
# Re-estimate the same model as purely reflective using CBSEM
cbsem_model = estimate_cbsem(mobi, as_reflective(measurements), structure)import {
parseCsv, constructs, reflective, composite, multiItems, singleItem, modeB,
relationships, paths, estimatePls, estimateCbsem, asReflective,
} from "@seminr/core";
// Load your data — any way of obtaining CSV text works
const mobi = parseCsv(await Bun.file("mobi.csv").text());
// Define measurements with familiar terms: reflective, composite, multi-item constructs, etc.
const measurements = constructs(
reflective("Image", multiItems("IMAG", [1, 2, 3, 4, 5])),
composite("Expectation", multiItems("CUEX", [1, 2, 3])),
composite("Loyalty", multiItems("CUSL", [1, 2, 3]), modeB),
composite("Complaints", singleItem("CUSCO")),
);
// Create four relationships (two regressions) in one line!
const structure = relationships(
paths(["Image", "Expectation"], ["Complaints", "Loyalty"]),
);
// Estimate the model with PLS (Consistent PLS for the reflective construct)
const plsModel = estimatePls(mobi, measurements, structure);
// Re-estimate the same model as purely reflective using CBSEM
const cbsemModel = estimateCbsem(mobi, asReflective(measurements), structure);Specify a model once, then estimate it with the technique that fits your question:
SEMinR is continuously tested against leading SEM software — SmartPLS, ADANCO, semPLS, and matrixpls — to ensure parity of outcomes.
Plot any supported model with a simple plot() method and save it to file, with customizable themes:
SEMinR goes well beyond simple path models, with high-level functions for the techniques modern SEM research relies on:
interaction_term()s using any of three methods (two_stage, product_indicator, or orthogonal), or quadratic_term()s, with known biases in PLS interaction estimates automatically corrected.higher_composite() via the two-stage approach.