A small, browser-based web app that removes the two most error-prone steps of an ESEM / bifactor-ESEM workflow in Mplus:
- Writing the
.inpsyntax — the(*1)ESEM blocks,~0target patterns, standardized-factor identification, and the measurement-invariance label bookkeeping. - Turning the
.outinto journal tables — fit indices, standardized loadings, ω, factor correlations, invariance comparisons, prose, and path diagrams.
It never uploads your data — syntax generation and output parsing happen in your browser. Online, you run
the generated .inp files in your own licensed Mplus and drop the resulting .out back in. Started locally with
node serve.mjs on a computer that has Mplus, the app runs the models itself: the topbar shows the Mplus
version it found, Run all in Mplus writes the files to mplus-runs/<stamp>/, and each .out flows into the
results as it finishes — nothing to download or upload. The online page can use that runner too: start
ESEM-Analyzer.exe (or node serve.mjs) and press Connect in the guide or on the Mplus pill; the page
links to it on localhost and remembers the choice. A first-visit Guide explains the four steps and both ways.
▶ Try it live (no install): https://cahitgs.github.io/esem-analyzer/
The Data page offers the two simulated data sets of Morin’s (2023) Hoyle-Handbook chapter with the model used in the tutorial article: Data Set 1 (Ch27-Data1.dat, two groups of 5,000, one non-invariant intercept) and Data Set 2 (Ch27-Data2.dat, the same 12 indicators at two occasions, bifactor-ESEM population). Load with the article’s model loads the file, the variable names and the sketch (3 factors, target rotation, all four measurement models, the six-step invariance sequence — 28 inputs), so that Generate syntax writes exactly the inputs of the article; the .dat files and the model .json files can also be downloaded. Direct links: https://cahitgs.github.io/esem-analyzer/?example=data1 and ?example=data2. The files are redistributed with the author’s permission (example-dataset/ch27/).
| Step | You do | The app does |
|---|---|---|
| 1 · Data | Upload a .dat / .csv |
Auto-detect columns, delimiter, header; export an Mplus-ready .dat |
| 2 · Model | Sketch the factor model on a Λ grid | Pick factors, rotation (Geomin / Target), estimator, bifactor, grouping |
| 3 · Syntax | — | Generate exact .inp for each model; download one file, a .zip, or write them straight into a working folder (auto mode) |
| 4 · Results | Drop your Mplus .out files — or let auto mode import them |
APA fit / loadings / bifactor / invariance tables + prose + path diagrams; copy to Word, .docx. The four-model fit table compares ESEM and bifactor-CFA with the CFA and bifactor-ESEM with the ESEM (Morin's sequence), with the Satorra–Bentler Δχ² only for nested pairs; an output Mplus stopped on an input error shows that error as its reason |
- CFA (independent-clusters, standardized-factor identification
F1 BY x1* …; F1@1;) - ESEM — Geomin (oblique/orthogonal, ε) and Target rotation
- Bifactor-CFA and Bifactor-ESEM (BI-GEOMIN orthogonal / orthogonal Target)
- Measurement invariance — across groups (multi-group) or across time (within-person, 2-wave longitudinal), for every checked measurement model — CFA, ESEM, bifactor-CFA and bifactor-ESEM each get their own sequence and their own results table: configural → weak → strong → strict → variance–covariance → latent means (Satorra–Bentler scaled Δχ² for MLR; ΔCFI/ΔTLI/ΔRMSEA read against Chen's 2007 guideline in the table note — no verdict column). Longitudinal models equate loadings across waves and correlate each indicator's residual over time (target rotation is written per wave with its
~0blocks; the checked measurement models are also estimated on the Time-1 indicators first, as in Morin's Table 1); the bifactor sequences follow Morin's Hoyle-Handbook chapter (orthogonal target rotation, general + specific factors). Group labels are made Mplus-legal (letters, digits, underscores, 8 characters) before they reach theGROUPINGline. - Partial invariance — when a step goes beyond the fit-change guideline, the Results page offers a partial model (Byrne et al., 1989; Morin, 2023): free the parameters with the largest modification indices of the failed model — intercepts or thresholds at the strong step, uniquenesses at the strict step; for CFA and bifactor-CFA also loadings, factor variances/covariances and latent means — one at a time, and the app writes the partial model (Morin's T11/T34 form,
[Z1] (i9); [Z2*]; [Z3 Z4] (i11-i12);in every group or wave) and the later steps built from it as a branch of the chain (Inv_3p_strong.inp…, its ownDIFFTESTfiles), runs the branch in the same folder, and the table reports the failed model (†, not retained), the partial model against the last retained step and the branch after it, with the note and the draft text saying what was freed and why. The strict and var–cov steps can also be left out of the later steps (for an ESEM set the var–cov step has no partial form; Morin's example is a latent-means model without the var–cov constraints), which are then compared with the last retained model. The steps are named as Morin names them (weak, strong). On Morin's Data 1 and Data 2 the branches reproduce the chapter's Table 27.1 exactly (test/partial.test.mjs). - Ordinal indicators — one choice for every item (Continuous · MLR or Ordinal · WLSMV, on the Data page or under Rotation & estimator). With ordinal indicators the multi-group sequence switches to the thresholds-based WLSMV + THETA chain (Millsap identification: first thresholds + one referent's second threshold equated from configural on) and wires the
DIFFTESThandshake between steps automatically; the Results table then reports Mplus's difference-test Δχ² instead of a (invalid) Satorra–Bentler value. The bifactor-ESEM sequence gets the same thresholds chain — with one extra referent threshold for the G factor (Morin's T15/T42 rule) and its ownBifactorInv_diff_*.datfiles. Across time the same thresholds chain runs for all four models (thresholds equated across waves through shared labels, Time-1 uniquenesses fixed at 1,LongInv_<model>_diff_*.datDIFFTEST files). Continuous and ordinal indicators are not mixed in one model: the estimator follows the response scale (four or fewer categories or asymmetric thresholds → WLSMV; Finney & DiStefano, 2013). A response category that is empty in one group or at one wave stops WLSMV; the Model step lists such sparse categories per group/wave and merges them into a neighbour on request (aDEFINE: IF (item EQ k) THEN item = j;line in every input). - ESEM-within-CFA — convert a rotated ESEM solution into an equivalent CFA you can embed in larger SEM/MIMIC/DIF models (Morin's referent method)
- Convergence aids (optional, on the Syntax step) — the two remedies Morin uses in the Hoyle-Handbook chapter: a loosened
CONVERGENCEcriterion (emitted for every model, invariance sequences included) and per-item residual-variance positivity constraints (item (res#); … MODEL CONSTRAINT: res# > 0;in the measurement models; in the invariance sequences a label per group or wave before the strict step, the step's equality label from the strict step on, and under WLSMV only where the residual variance is free — the non-reference groups or Time 2 before the strict step) for Heywood cases. With a missing-value code and an ML-family estimator the loosened criterion also brings a matchingH1CONVERGENCEline, plusH1ITERATIONSwherever anITERATIONSline is set (Morin's T32 note). Every model requests Morin's recommendedOUTPUT: SAMPSTAT STANDARDIZED MODINDICES CINTERVAL RESIDUAL SVALUES TECH1 TECH3 TECH4; - Run in Mplus from the app (local
node serve.mjs+ Mplus installed) — one button runs every generated model on your computer, one after another (invariance sequences keep theirDIFFTESTorder), with live status, a stop button and the Mplus log; outputs import themselves. ESEM-within-CFA models generated from a local run can be run from their card too. - Auto mode (fallback when the local server is not running; Chrome/Edge desktop) — pick a local working folder and the app writes every
.inp, the Mplus-ready.dat, and aRUN-ALL.batthere; double-click that file once and the results import themselves as each model finishes. Nothing is uploaded — the folder, the bat, and Mplus are all on your machine.
Standardized-loadings tables follow Morin's Table-2 layout — items grouped into subscale blocks with a per-block ω row, target loadings bold, non-significant loadings italic — identically in the browser, the copy-to-Word HTML, and the .docx export.
Factors, items, correlations, uniquenesses, and a proper bifactor layout (specific factors one side, the global factor reaching every item the other side). Diagrams are interactive — toggle cross-loadings / uniquenesses, show/hide factors, drag the ellipses to reposition for reporting, and export SVG / PNG.
After you run an ESEM with OUTPUT: SVALUES; (the app adds this automatically), drop the .out back in
and the Results step offers a one-click conversion to ESEM-within-CFA: it reads the rotated solution's
unstandardized estimates, picks a referent indicator per factor, fixes that referent's cross-loadings to
their ESEM values (and, for bifactor, all factor correlations to 0), and writes a runnable .inp.
Two identification forms are offered: standard (factor variances @1 — for MIMIC/DIF or factors
predicting outcomes) and higher-order (the referent's main loading also fixed, variances *1 — for
factors that become endogenous, e.g. under a higher-order factor).
Verified against real Mplus 8.3: the generated oblique ESEM-within-CFA reproduces the source ESEM
exactly — identical number of free parameters, degrees of freedom, χ², and log-likelihood
(e.g. the bundled 3-factor ESEM: npar 72, df 63, LL −11107.13 in both). See GUIDE.md.
The app itself is a static site, but serve.mjs is also the local Mplus runner, so start it with Node:
node serve.mjs # → http://localhost:3001 — also detects Mplus and runs models from the app node serve.mjs --open # same, and opens the browser PORT=3400 node serve.mjs # another port; MPLUS_PATH=... if Mplus.exe is not in a Program Files\Mplus* folder (every such folder is probed, the newest version wins) # any static server works too (no local runs; download / drop .out instead) python -m http.server 8000
Then open the URL and follow Data → Model → Syntax → Results. A ready-made example with real Mplus
outputs lives in example-dataset/ — open the app, choose "Skip to reading .out
files →", and drop example-dataset/2_ESEM_geomin.out.
No build step, no dependencies to install (the local runner is a zero-dependency Node script). Tailwind, docx,
and JSZip load from CDNs; the four engines (syntax generator, .out parser, APA render, ESEM-within-CFA) are plain
ES modules.
For colleagues who have Mplus but not Node: node tools/build-exe.mjs packages the app and the runner into a single
Windows executable, dist/ESEM-Analyzer.exe (~105 MB; Node is inside). Double-click it: a console window opens (it is the runner —
leave it open, there is nothing to type in it), the browser opens on http://localhost:3001 (or the next free port), the
topbar shows the Mplus it found, and Run all in Mplus works with nothing else installed. Runs are written to mplus-runs/ next to the exe; closing
the window stops it. The exe is unsigned, so SmartScreen asks once ("More info → Run anyway"). Build on a machine
with Node 20.12+; the first build fetches postject via npx. The runner also answers the online page on
localhost (CORS for the GitHub Pages origin; ALLOW_ORIGINS adds others), so the published UI can drive it.
The engines are unit-tested against real Mplus .out fixtures, and the generated syntax has been run
back through Mplus 8.3 to confirm it reproduces the intended models (matching degrees of freedom and fit).
The same inputs were re-run in Mplus 9.1.1 (November 2026): every converged model parses to the same values,
and the sections Mplus 9.1 added (the side-by-side STANDARDIZED SOLUTION, the moved QUALITY OF NUMERICAL RESULTS, the new wording for a model without a χ²) are covered by test/mplus91.test.mjs.
node test/parser.test.mjs # .out parser (70) node test/dataparse.test.mjs # data-file detection (21) node test/specstore.test.mjs # model specification save / restore (.json, localStorage) (14) node test/collapse.test.mjs # sparse response categories: detection per group/wave, DEFINE merges, Mplus error (19) node test/ewc.test.mjs # ESEM-within-CFA (52) node test/longitudinal.test.mjs # longitudinal invariance (104) node test/apa.test.mjs # Morin-style APA tables + the four-model fit table + Satorra–Bentler scaled Δχ² (27) node test/docx.test.mjs # Word/.docx export (15) node test/aids.test.mjs # convergence aids, incl. the residual constraint in the invariance sequences (56) node test/runscripts.test.mjs # auto-mode run scripts (18) node test/mginv.test.mjs # MG bifactor-ESEM invariance + Mplus-legal group labels (63) node test/catinv.test.mjs # categorical WLSMV invariance + DIFFTEST, ESEM + bifactor-ESEM chains, one indicator type for every item (127) node test/invorder.test.mjs # invariance step order, unestimated outputs (MG + longitudinal), total-sample models, ID columns, Time-2 pairing incl. an 18 000-file name sweep, Mplus input errors, invariance tables without a verdict column (142) node test/examples.test.mjs # the article’s two example data sets: presets regenerate the article’s 56 inputs byte for byte (20) node test/mplus91.test.mjs # Mplus 9.1.1 outputs parse like the 8.3 outputs of the same inputs (side-by-side section, DIFFTEST, no-χ² wording) (34) node test/partial.test.mjs # partial invariance: the branch (Morin's T11/T34 forms), skipped steps, DIFFTEST handshake, title tag + modification indices, tables/notes/prose/Word, real Mplus 9.1.1 runs reproducing Table 27.1, a long TITLE wrapped at Mplus's 90-character line, the sweep follow-ups (110)
The two multi-group invariance engines were additionally cross-validated against De Beer & Morin's
(B)ESEM syntax generator (statstools.app/b_esem): on the same data,
both tools' models produce identical free-parameter counts, degrees of freedom, χ², and — for the
categorical chain — identical DIFFTEST Δχ² values at every step in real Mplus 8.3 runs. The categorical
bifactor-ESEM chain, added later, was verified in real Mplus 8.3 runs: every step converges, and the
free-parameter counts, df and DIFFTEST df match the intended constraints (test/catinv.test.mjs).
index.html shell (topbar, control column, desk + manuscript, Mplus sheet)
css/app.css design system ("living manuscript")
serve.mjs local server + Mplus runner (health, runs, SSE job events)
tools/build-exe.mjs packages app + runner into dist/ESEM-Analyzer.exe (Node SEA)
js/
shell.js UI helpers, Mplus sheet, the paper, tooltips
runner.js browser side of the local Mplus runner (same origin or localhost connect)
guide.js first-visit guide: the four steps and the two ways to run Mplus
state.js ModelSpec + validation
data-parse.js .dat/.csv reader + Mplus-ready .dat export
model-builder.js Λ target-pattern grid + controls
syntax-generator.js buildInp(spec, modelType) — exact Mplus templates
out-parser.js parseOut(text) → ParsedModel
ewc.js ESEM-within-CFA (parse SVALUES, build EWC .inp)
apa-render.js APA tables + prose + Satorra–Bentler Δχ²
diagram.js SVG path diagrams (interactive)
docx-export.js copy-to-Word, .docx, .zip
test/ node test runners + real .out fixtures
example-dataset/ synthetic 3-factor data + ready .inp/.out
docs/img/ screenshots used in the docs
See the full walkthrough in GUIDE.md.
- This is an independent helper. You need your own licensed copy of Mplus to run the syntax.
- Your data and output files never leave the browser; the app makes no network requests with them.
- The reference article and its supplement are © their publisher and are not redistributed here.
MIT © 2026 Mehmet Cahit Marangoz

