ANALYSIS CLINIC · CASE 001

CASE STATUS: DIAGNOSED

My model won't run · SEM · lavaan, Mplus, AMOS

Why Won't My SEM Model Converge?

Nonconvergence means the estimation procedure did not reach a satisfactory solution. It tells you to stop before interpreting estimates or fit—not which shortcut to use. The right response is to identify why estimation stopped, then choose a remedy that preserves the research question and model's meaning.

01

Symptoms

You run a CFA or structural equation model, but the software does not report a completed solution. In lavaan 0.6-21, one verified message is:

lavaan->lav_lavaan_step11_estoptim():
   the optimizer warns that a solution has NOT been found!

Mplus users may see an estimation-termination message and should request the relevant optimization history, such as TECH5 or TECH8. AMOS users may see that estimation did not converge or stopped before a solution was obtained. Copy your own message exactly: wording and available diagnostics vary by software and version.

02

What This Usually Means

The optimizer was searching for parameter values that satisfy its stopping criteria and did not get there. That may reflect a numerical setting, but it may also expose a problem with identification, variable scales, the information in the sample, the estimator, or the model specification.

Nonconvergence is therefore a symptom, not a diagnosis. It is also different from an inadmissible solution: a model can converge and still contain a negative variance, an impossible correlation, or an information-matrix problem.

03

Common Causes

1. The model is not identified

Different parameter values can reproduce the same observed information, or the data do not provide enough independent information for all free parameters.

2. Variables are on very different scales

Large variance differences can make numerical optimization unstable. Units and sample variances should be reviewed before changing the model.

3. The model is too demanding for the sample

Small samples, sparse categories, few clusters, or little variance at one level can leave too little information for a complex specification.

4. The estimator and data do not match

Ordinal indicators treated as continuous, problematic missing-data handling, or a likelihood poorly suited to the observed data can contribute to estimation difficulty.

5. Starting values or optimizer progress are poor

The run may exhaust its iteration allowance or stall. This branch is considered only after checking the model, data, and preliminary estimates.

6. The specification conflicts with the data

Near-duplicate factors, extreme latent correlations, an unnecessarily elaborate structure, or unsupported constraints can create a difficult or inadmissible solution.

04

Run These Checks

  1. Preserve the exact termination information.

    Record the warning, software and version, estimator, iteration count, and any optimization history. In lavaan, start with lavInspect(fit, "converged"), lavInspect(fit, "iterations"), and lavInspect(fit, "optim").

    What it suggests: Reaching the maximum iterations differs from stopping early because the objective cannot be improved. Neither result, by itself, tells you to increase the limit.

  2. Separate convergence from identification and admissibility.

    Review warnings about standard errors, the information matrix, negative variances, and non-positive-definite observed or latent covariance matrices. In lavaan, examine the parameter table, lavInspect(fit, "gradient"), relevant covariance matrices, and lavInspect(fit, "post.check").

    What it suggests: A failed information matrix or impossible estimate points away from “more iterations” and toward identification, scaling, data, or specification.

  3. Audit units, variances, and correlations.

    Use varTable(fit) or an equivalent descriptive review. Confirm coding, ranges, near-zero variance, extreme correlations, and whether one variable's variance dwarfs the others.

    What it suggests: A unit mismatch may justify a documented rescaling. An extreme relationship may instead indicate miscoding, redundancy, or weak construct separation.

  4. Verify estimator-data compatibility.

    Check which variables are ordinal or categorical, how missing observations were handled, whether clusters or weights were specified correctly, and whether the selected estimator matches those conditions.

    What it suggests: A mismatch calls for a substantively appropriate estimator or data declaration—not whichever option happens to converge.

  5. Build the model in defensible components.

    Fit the measurement pieces and theoretically required structural pieces separately, then add complexity in an order determined before looking for a convenient result.

    What it suggests: The stage at which estimation fails localizes the problem. A component model is diagnostic evidence, not permission to abandon the planned estimand.

  6. Only then evaluate numerical remedies.

    When the history shows continued progress and the previous checks are satisfactory, consider justified starting values, an adequate iteration allowance, or a supported alternative optimizer.

    What it suggests: If results depend materially on arbitrary settings or disagree across reasonable procedures, the instability itself must be investigated and reported.

05

What Not to Do

Do not interpret the last printed estimates as results. A failed run may return starting values or an unfinished iterate, not a reportable solution.

Do not raise the iteration limit automatically. More iterations do not identify a model, correct miscoding, add information, or make an impossible solution admissible.

Do not delete indicators, paths, factors, or residual relationships only to make the warning disappear. Those changes alter the model and require theoretical and design-based justification.

Do not force convergence or disable diagnostic checks. A software flag cannot turn an unverified solution into evidence.

Do not move directly to fit indices. Model fit is not interpretable until estimation has produced a valid, admissible solution.

06

Treatment Options

Correct data or scale problems

Use when: the audit identifies coding errors, unit disparities, near-zero variance, or another verifiable data issue.

Tradeoff: rescaling changes units but not the underlying model; transformations or category changes can change the estimand and need stronger justification.

Repair identification

Use when: the model contains redundant parameters, insufficient indicators or constraints, or another identifiable source of underidentification.

Tradeoff: constraints and marker choices must be substantively defensible; they cannot be added solely because they produce output.

Match the estimator to the data

Use when: variable type, missingness, clustering, or distributional conditions make the original estimator inappropriate.

Tradeoff: estimators can change standard errors, tests, assumptions, and sometimes the interpretation of parameters.

Simplify only with a defensible scope change

Use when: the research question can genuinely be answered by a pre-specified or theoretically justified simpler model.

Tradeoff: a simpler model may answer a narrower question. Document what was removed and why.

Adjust numerical controls

Use when: the optimization history supports slow but coherent progress and the model has passed the preceding checks.

Tradeoff: a converged status after more iterations or a new optimizer still requires gradient, identification, admissibility, and substantive review.

Treatment principle: the objective is a defensible model for the research question—not the disappearance of a warning.

07

Worked Example

This controlled lavaan example generates 250 synthetic observations from a three-factor population model. It deliberately caps the optimizer at one iteration, which creates a stable nonconvergence symptom with a known cause. The same identified model and data are then fitted under ordinary controls.

See it in R and Python

Python fits the same three-factor covariance model by normal maximum likelihood using NumPy and SciPy. It is a compact educational implementation, not a general SEM package. Positive variance parameterization and numerical diagnostics differ from lavaan; optimizer iteration counts are not expected to match.

Python dependencies: NumPy and SciPy. Install them with python -m pip install numpy scipy.

Download the shared synthetic CSV beside the Python script before running it. Identical numeric seeds in R and Python do not generally generate identical samples; the CSV preserves the R-generated observations.

# Analysis Clinic Case 001: a controlled lavaan nonconvergence example
#
# Purpose: reproduce lavaan's maximum-iteration failure, show the diagnostic
# fields a researcher should inspect, and verify that estimates from the failed
# run are not interpreted. The one-iteration cap is deliberately artificial so
# the symptom is stable and the cause is known. It illustrates one cause of
# nonconvergence; it is not a claim that raising the limit fixes other causes.

suppressPackageStartupMessages(library(lavaan))

set.seed(20261003)

population_model <- '
  visual  =~ 0.80*x1 + 0.70*x2 + 0.75*x3
  textual =~ 0.85*x4 + 0.80*x5 + 0.70*x6
  speed   =~ 0.75*x7 + 0.70*x8 + 0.80*x9

  visual ~~ 0.35*textual
  visual ~~ 0.25*speed
  textual ~~ 0.30*speed

  visual ~~ 1*visual
  textual ~~ 1*textual
  speed ~~ 1*speed

  x1 ~~ 0.36*x1
  x2 ~~ 0.51*x2
  x3 ~~ 0.4375*x3
  x4 ~~ 0.2775*x4
  x5 ~~ 0.36*x5
  x6 ~~ 0.51*x6
  x7 ~~ 0.4375*x7
  x8 ~~ 0.51*x8
  x9 ~~ 0.36*x9
'

analysis_model <- '
  visual  =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
'

dat <- simulateData(population_model, sample.nobs = 250)

# Deliberately stop the optimizer after one iteration. Capture the exact warning
# so changes in future lavaan versions are visible during verification.
failed_warnings <- character()
fit_failed <- withCallingHandlers(
  cfa(
    analysis_model,
    data = dat,
    control = list(iter.max = 1)
  ),
  warning = function(w) {
    failed_warnings <<- c(failed_warnings, conditionMessage(w))
    invokeRestart("muffleWarning")
  }
)

# Refit the same identified model and same data with lavaan's ordinary optimizer
# controls. This is defensible here because the failed run's cause was the
# artificial one-iteration cap. It is not a general prescription.
fit_default <- cfa(analysis_model, data = dat)

failed_optim <- lavInspect(fit_failed, "optim")
default_optim <- lavInspect(fit_default, "optim")

cat("R version:", R.version.string, "\n")
cat("lavaan version:", as.character(packageVersion("lavaan")), "\n")
cat("seed: 20261003\n")
cat("n:", nrow(dat), "\n\n")

cat("FAILED RUN (deliberate iter.max = 1)\n")
cat("warning:", paste(failed_warnings, collapse = " | "), "\n")
cat("lavInspect converged:", lavInspect(fit_failed, "converged"), "\n")
cat("optimizer iterations:", failed_optim$iterations, "\n")
cat("optimizer message:", failed_optim$warn.txt, "\n")
cat("fit measures available:", length(tryCatch(fitMeasures(fit_failed), error = function(e) numeric())), "\n\n")

cat("DEFAULT-CONTROL REFIT (same model and data)\n")
cat("lavInspect converged:", lavInspect(fit_default, "converged"), "\n")
cat("optimizer iterations:", default_optim$iterations, "\n")
cat("largest absolute gradient:", format(max(abs(lavInspect(fit_default, "gradient"))), scientific = TRUE), "\n")
cat("post-fit admissibility check:", lavInspect(fit_default, "post.check"), "\n")
cat("CFI:", round(fitMeasures(fit_default, "cfi"), 3), "\n")
cat("RMSEA:", round(fitMeasures(fit_default, "rmsea"), 3), "\n\n")

cat("INTERPRETATION\n")
cat("The first fit did not converge because it was prevented from taking more than one iteration.\n")
cat("Its parameter values and fit measures must not be interpreted.\n")
cat("The refit converged under ordinary controls, had a near-zero gradient, and passed lavaan's post-fit check.\n")
cat("This comparison supports the known diagnosis in this controlled example only; increasing iterations is not a general remedy for misspecification, nonidentification, scaling problems, or inadmissible solutions.\n")

stopifnot(
  identical(lavInspect(fit_failed, "converged"), FALSE),
  identical(lavInspect(fit_default, "converged"), TRUE),
  failed_optim$iterations == 1,
  max(abs(lavInspect(fit_default, "gradient"))) < 0.001,
  identical(lavInspect(fit_default, "post.check"), TRUE)
)
"""Case 001: controlled CFA nonconvergence, NumPy + SciPy.
Download case-001-shared-data.csv beside this script. Run with Python.
Fits the same three-factor marker-variable CFA covariance model by normal ML.
This compact educational implementation is not a general SEM package.
Iteration counts/gradients differ from lavaan because optimizers differ.
"""
import csv
from pathlib import Path
import numpy as np
import scipy
from scipy.optimize import minimize

with Path(__file__).with_name('case-001-shared-data.csv').open() as f:
    rows = list(csv.DictReader(f))
data = np.array([[float(r[f'x{i}']) for i in range(1, 10)] for r in rows])
S = np.cov(data, rowvar=False, bias=True)  # normal-ML covariance, divisor N

def matrices(p):
    load = np.zeros((9, 3))
    for k in range(3):
        load[3*k, k] = 1  # marker loading identifies each factor scale
        load[3*k+1:3*k+3, k] = p[2*k:2*k+2]
    L = np.zeros((3, 3))
    L[np.tril_indices(3)] = p[6:12]
    phi = L @ L.T
    residual = np.exp(p[12:21])
    return load @ phi @ load.T + np.diag(residual), phi, residual

def objective(p):
    sigma, _, _ = matrices(p)
    sign, logdet = np.linalg.slogdet(sigma)
    if sign <= 0:
        return 1e20
    return logdet + np.trace(np.linalg.solve(sigma, S))

start = np.r_[np.repeat(.8, 6), [1, 0, 1, 0, 0, 1], np.log(np.repeat(.5, 9))]
options = dict(ftol=1e-14, gtol=1e-7, maxls=50)
failed = minimize(objective, start, method='L-BFGS-B', jac='3-point',
                  options={**options, 'maxiter': 1})
refit = minimize(objective, start, method='L-BFGS-B', jac='3-point',
                 options={**options, 'maxiter': 2000})
sigma, phi, residual = matrices(refit.x)
print('NumPy', np.__version__, 'SciPy', scipy.__version__)
print('Limited run:', failed.success, 'iterations:', failed.nit, failed.message)
print('Refit:', refit.success, 'iterations:', refit.nit, refit.message)
print('Largest numerical gradient:', np.max(np.abs(refit.jac)))
print('Smallest latent covariance eigenvalue:', np.linalg.eigvalsh(phi).min())
print('Smallest residual variance:', residual.min())
print('Do not interpret the failed run. The iteration cap is artificial.')
print('Positive variances are enforced here; this is not lavaan post.check().')
assert not failed.success and failed.nit == 1
assert refit.success and np.max(np.abs(refit.jac)) < 1e-4
assert np.linalg.eigvalsh(phi).min() > 0 and residual.min() > 0
assert refit.fun < failed.fun
print('All checks passed.')

Failed run: converged = FALSE; 1 iteration; 0 fit measures available.

Ordinary-control refit: converged = TRUE; 29 iterations; largest absolute gradient = 1.695211e-07; post-fit check = TRUE.

Interpretation: the first run failed because the example prevented it from continuing beyond one iteration. Its estimates and fit are not interpreted. Restoring ordinary controls is justified in this controlled example because the constraint was deliberately created. This does not show that increasing iterations repairs nonidentification, misspecification, scaling problems, or inadmissible solutions.

Download the complete verified R script

Python verification: one-iteration run did not converge; refit converged in 41 iterations, with maximum numerical gradient approximately 5.47e−7. The smallest latent covariance eigenvalue was .39137 and the smallest residual variance .19794. These are checks for this constrained implementation, not lavaan post.check().

Download verified Python script · Download shared synthetic CSV

08

What to Tell Your Committee

Be prepared to explain the reasoning, not just the final software status:

  1. Symptom: give the exact termination message, software version, estimator, and iteration result.
  2. Diagnosis: describe the checks used to distinguish numerical, identification, data, estimator, and specification explanations.
  3. Remedy: connect the chosen change to the identified cause and explain whether it changed the model or estimand.
  4. Verification: report how convergence, gradients, standard errors or information, admissibility, and sensitivity to reasonable settings were reviewed.
  5. Limits: state what the final model does and does not support.

A defensible explanation is specific to the research question, design, data, and actual diagnostics. Do not copy a generic claim that “the convergence problem was fixed” without showing what caused it and why the response was appropriate.

09 · ANALYSIS CLINIC

When You Need More Help

Still stuck?

Some models stop because of a visible setting or coding problem. Others require the syntax, full output, sample information, and covariance structure to separate identification, estimation, data, and specification causes.

Bring your model to the Analysis Clinic. SEM Rescue is the individualized route for lavaan, Mplus, and AMOS problems when the checks above do not identify a defensible next step.

Send my output

No raw data needed for most cases · Reply within one business day

TWO WAYS TO GET UNSTUCK

Start with a diagnosis.
Go further if you need to.

Most students only need the diagnosis. If the model has to be rebuilt, the full rescue covers it.

Diagnosis

$250

Delivered within 72 hours

  • What's wrong and why it happened
  • Corrected syntax you can run yourself
  • A plain-English explanation you can defend

Full rescue

$900

Your diagnosis fee counts toward it

  • I re-specify and re-run the model
  • A short memo explaining the changes for your committee

I take a limited number of diagnoses each week so the 72-hour turnaround holds. If this week is full, I'll tell you when yours starts before you pay.

WHAT TO SEND

Your output,
not your data.

Most problems can be diagnosed from what the software prints. That keeps participant data out of it and avoids IRB data-sharing issues.

HOW IT WORKS

Three steps, no surprises.

01

Send your output

Fill in the form below. Nothing is charged when you submit.

02

Confirm the fit

Within one business day, I reply to confirm I can help and send a payment link. The 72-hour diagnosis window starts once payment is complete.

03

Get your diagnosis

What's wrong, why, and corrected syntax, with an explanation you can take to your committee.

This is consulting, not ghostwriting. Every fix comes with an explanation you can defend, and I encourage you to tell your advisor you got statistical help.

SEND YOUR OUTPUT

Tell me what went wrong.

Paste text into the boxes, or attach a text file where you see the option. Fields marked optional can be skipped.

Prefer to talk first? Book a free 30-minute consultation

Can't find a time that works? Email bookingrequest@dissertationstatshelper.com with a few times you're available and your time zone, and we'll find a time. It's a new address, so if you don't see our reply, please check your spam folder.

About you
Which service?
Your model

Copy it exactly, including the first line.

The lavaan model string, your Mplus input, or for AMOS, a description of the model.

All of it, not just the warning.

Only the variables in your model, for example round(cov(dat), 4) and round(colMeans(dat), 4). No raw data.

For example, your estimator, how you handled missing data, or what you've already tried.

Your timeline
Before you send

What you send is emailed to Dr. Yel through our email provider, Resend, and used only to respond to your request. See the privacy policy.