(G)LMM β€” Mixed Models Interactive
Gaussian Β· Poisson Β· Gamma Β· Logistic Β· Partial/No/Complete Pooling Β· Shrinkage Β· ICC Β· Simpson
Β© Dr. Rainer DΓΌsing Β· Interactive Tools by Claude
Mixed Model = Fixed Effects (the same for all groups) + Random Effects (group-specific deviations that share information between groups)
πŸš€ How to get started Your own results in 3 steps.
1 Choose a likelihoodPick the distribution that fits your data.
β€Ί
2 Compare poolingSwitch between Partial, No, and Complete Pooling.
β€Ί
3 Read group differencesCompare effects below and spot shrinkage.

⚠ Illustration tool: Estimates via IRLS + Method-of-Moments β€” no Laplace approximation (lme4/glmmTMB). Direction and order of magnitude are correct, exact values may differ.

Likelihoodβ€” distribution of the data
Poolingβ€” group structure
MAIN PLOT β€” DATA & REGRESSION LINES
Partial Pooling: Group lines with shrinkage
⚠Simpson risk: Complete pooling line shows a different direction than the within-group effects β€” do not ignore the group structure!
RANDOM EFFECTS
Group Intercepts β€” No-Pooling vs. Partial-Pooling
SHRINKAGE DIAGRAM
No Pooling vs. Partial Pooling Intercepts
How to read? Each row = one group, sorted by no-pooling intercept (top = largest). β—‹ = No-Pooling  Β·  ● = Partial-Pooling. Arrow shows direction and strength of shrinkage toward the GLMM Fixed Effect (Ξ³β‚€β‚€, dashed).
MODEL RESULTS
Estimated Parameters & Metrics
Learning Cards β€” Deeper Concepts
ICC β€” Intraclass Correlation
ICC = Ο„β‚€Β² / (Ο„β‚€Β² + σ²)

The proportion of total variance that lies between groups. Rule of thumb: ICC > 0.05 β†’ LMM is necessary, since observations within a group are not independent.

But beware: such thresholds are only rough rules of thumb. Bliese (1998) showed that even noticeably smaller ICCs can already produce bias once a cluster structure is present β€” there is no reliable "safe" lower bound.

Practical tip: the trade-off usually favors the LMM. If you know a clustering variable exists, you're generally well advised to use an LMM instead of Complete Pooling right away β€” even if the ICC later turns out small, doing so costs you almost nothing.

Important: The ICC itself is not a parameter the LMM estimates β€” it's just a helper value computed afterward from Ο„β‚€ and Οƒ, to roughly gauge how strongly clustered the data are. The model itself only "knows" Ο„β‚€ (the spread of the group intercepts) and accounts for exactly that Ο„β‚€ directly through the random effects β€” regardless of whether you compute the ICC at all. If Ο„β‚€ is large (and thus the ICC is high), the LMM pulls comparatively little toward the overall mean (weak shrinkage); if Ο„β‚€ is instead β‰ˆ 0 (ICC β‰ˆ 0), the LMM and Complete Pooling will typically give very similar results, because there's then hardly any real group difference left for partial pooling to account for.
GLMM β€” When to use which likelihood?
The mixed model principle applies to all distribution families:

Gaussian (LMM): Continuous, symmetric DV. y ~ Normal(ΞΌ, Οƒ)

Poisson (GLMM): Count data (0, 1, 2, …). Log link: log(Ξ») = Ξ· β€” Ξ» stays positive.

Gamma (GLMM): Positive, right-skewed data (reaction times, costs). Log link.

Logistic (GLMM): Binary DV (0/1). Logit link: log(p/(1βˆ’p)) = Ξ· β€” p stays in (0,1).

In brms: family = poisson(), family = Gamma(link="log"), family = bernoulli()
Random Intercept vs. Intercept + Slope
Random Intercept (Ο„β‚€ > 0): Groups differ in their baseline level β€” parallel lines with different y-intercepts.
Formula: y ~ x + (1|group)

Random Intercept + Slope (Ο„β‚€, τ₁ > 0): Groups also have different slopes β€” no fan-out or fan-in.
Formula: y ~ x + (1+x|group)

The parameter ρ controls the correlation: ρ > 0 β†’ groups with high intercept also have steep slope (fan-out). ρ < 0 β†’ lines cross each other (fan-in).

Note on No Pooling: under "Random Intercept" it compares against a common slope there (y ~ x + group) β€” matching the RE structure (1|group). Group-specific slopes (y ~ x * group) only appear under "Intercept + Slope".
When x correlates with group membership (x-group offset > 0), the marginal trend (complete pooling over all data) can be opposite to the within-group trend.

Example: Within each group y increases with x β€” but groups with high x also have lower intercepts. The complete pooling line shows a negative overall trend, even though the true effect is positive.

Solution: Partial pooling separates the within-group effect (γ₁₀) from the between-group effect.
Shrinkage factor Ξ» = Ο„β‚€Β² / (Ο„β‚€Β² + σ²/n_j)

Determines how strongly the group-specific estimate is pulled toward the GLMM Fixed Effect. With small n_j or small Ο„β‚€ β†’ strong shrinkage. Visible in the shrinkage diagram as arrow length.
β„Ή (G)LMM Interactive β€” Help
What do I learn here?
When data have a group structure (persons, schools, clinics), simple regressions are problematic β€” observations within a group are not independent. Mixed Models solve this through Random Effects: each group gets its own intercept uβ‚€β±Ό, drawn from a common distribution N(0, Ο„β‚€).
Recommended exploration
The most important panels
Group lines: Fixed Effect (Ξ³β‚€β‚€ + γ₁₀·x) + group-specific deviation uβ‚€β±Ό β€” Partial Pooling shrinks all lines toward the GLMM Fixed Effect

Shrinkage diagram: No-pooling estimate β†’ Partial-pooling estimate; arrows show the pull. Groups with small n are pulled more strongly.

ICC bar: Ο„β‚€Β²/(Ο„β‚€Β²+σ²) β€” proportion of variance between groups. ICC > 0.05 indicates that a mixed model is needed.

RΒ²_marginal / RΒ²_conditional: RΒ²_marginal explains variance via the fixed effects only, RΒ²_conditional also via the group structure (random effects) β€” the difference shows its explanatory contribution. Both values always refer to the GLMM itself and do not change with the pooling strategy.

Simpson warning: appears when Complete Pooling reverses the direction of the slope β€” the classic Simpson's Paradox.
n_j Unbalance & Slope Comparison
The n_j Unbalance slider (Data Generation) lets group sizes vary linearly (0 = all groups the same size). This makes it visible that the GLMM Fixed Effect (Partial Pooling) and the No-Pooling Grand Mean are always identical for equally sized groups β€” only with unequal n_j do they diverge.

Grand Mean (No Pooling): a simple n_j-weighted average of the independent group estimates β€” larger groups automatically count more.
GLMM Fixed Effect (Partial Pooling): precision-weighted (weight ∝ n_j/(n_jΒ·Ο„β‚€Β²+V₁)) β€” the actual shrinkage target. When between-group variance dominates (Ο„β‚€Β² large), every group counts almost equally, regardless of its size.

The Slope Comparison table (below Model Comparison) shows both values together with the Complete-Pooling slope β€” each row in the color of its line in the main plot.
GLM families
Gaussian: continuous data β€” classic LMM
Poisson: count data (0,1,2,…) β€” log link
Gamma: positive continuous data β€” log link
Logistic: 0/1 data β€” logit link

Further Reading
McElreath (2020) β€” hierarchical models, Bayesian workflow
Gelman, Hill & Vehtari (2020) β€” Regression and Other Stories
Finch & Bolin (2024) β€” multilevel models in R