GLMM (binary) — logistic mixed-effects (random intercept)

Verified

Advanced & specialized

Independently verified. Every statistic this test reports has been re-derived against an independent reference — never the library the pipeline itself calls — the rendered output was read back in a browser, and the result is locked with a committed regression suite.

Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.

Loading teaching datasets…

Or use your own dataset

Loading your datasets…

Fits Pr(y_ij = 1) = logit⁻¹(x_ij'β + u_j), u_j ~ N(0, σ²_u), with Bernoulli family + logit link.

Handles BINARY outcomes measured repeatedly within clusters or subjects. Returns fixed-effect coefficients with odds ratios, posterior SD, 95% credible intervals, p-values, the latent-scale ICC (σ²_u / (σ²_u + π²/3)), per-cluster predicted probabilities, and a Bernoulli-GEE comparison documenting the subject-specific vs population-averaged interpretation. Estimation via Laplace or adaptive Gauss-Hermite quadrature.

Worked example

What drives a yes/no outcome measured repeatedly within clusters?

A generalised linear mixed model (binary) adds random effects for clusters to a logistic model, giving subject-specific odds ratios.

Result

The treatment raised the subject-specific odds of success (OR = 1.9, p = .002); between-cluster variance was notable.

How you'd report it (APA)

A binary GLMM showed the treatment increased the odds of success, OR = 1.9, p = .002 (random cluster intercepts).

When to use it

  • Repeated binary measures per subject
    Trial-level data: correct response ~ trial-block + condition + (1 | subject) in 60 subjects × 200 trials each.
  • Nested binary outcomes (multi-level studies)
    Graduated yes/no ~ ses + gender + (1 | school) (n = 5000 students × 100 schools).

When NOT to — use instead

Hypotheses

H₀: β_j = 0 for each fixed-effect coefficient AND σ²_u = 0 for the random-intercept variance.
Hₐ: at least one β_j ≠ 0; σ²_u > 0 signals meaningful between-cluster variation in baseline log-odds.

Parameter tested: fixed-effect log-odds coefficients β + random-effect variance σ²_u

Assumptions (and what to do if they fail)

Latent-scale ICC = σ²_u / (σ²_u + π²/3). ICC_latent ≥ 0.05 justifies the random intercept; < 0.05 means logistic_regression would give nearly identical inference.medium

Check: σ²_u posterior mean and latent ICC.

If violated: ICC_latent ≈ 0 → no meaningful between-cluster variance in the log-odds.

GLMM β are SUBJECT-SPECIFIC log-odds ratios. Marginal (population-averaged) GEE-Bernoulli coefficients are attenuated relative to GLMM by a factor ≈ √(1 + 0.346·σ²_u). Agreement between re-scaled GEE and GLMM confirms the scale relationship.low

Check: Compute the attenuation factor and attenuated β.

If violated: Large gap between re-scaled GLMM and GEE suggests the random-effects distribution may be misspecified or σ²_u is poorly estimated.

Variational-Bayes posterior standard deviations should be finite and on a reasonable scale; posterior SD much larger than fixed-effect magnitude signals non-identifiability.medium

Check: All posterior SDs finite; SD/|mean| < 2 for all predictors.

If violated: Unstable posteriors often indicate separation or sparse clusters.

Ready to run a GLMM (binary) — logistic mixed-effects (random intercept) on your own data?

Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.

Run this test →