(G)LMM β€” Mixed Models Interactive
Gaussian Β· Poisson Β· Gamma Β· Logistic Β· Partial/No/Complete Pooling Β· Shrinkage Β· ICC Β· Simpson
Β© Dr. Rainer DΓΌsing Β· Interactive Tools by Claude

⚠ 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:
POOLING:
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!
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 grand mean (Ξ³Μ‚β‚€β‚€, dashed).
MODEL RESULTS
Estimated Parameters & Metrics
What is a Mixed Model?
A Mixed Model combines Fixed Effects (Ξ³ β€” the same for all groups) with Random Effects (uβ‚€β±Ό β€” group-specific deviations). The basic model is:

y_ij = Ξ³β‚€β‚€ + γ₁₀·x_ij + uβ‚€β±Ό + Ξ΅_ij

The uβ‚€β±Ό are not estimated directly but modeled as random variables: uβ‚€β±Ό ~ Normal(0, Ο„β‚€Β²). This enables information sharing between groups β€” each group benefits from the data of the others.
Complete Β· No Β· Partial Pooling
Complete Pooling: One line for all β€” group structure is ignored. Efficient, but biased when groups truly differ.

No Pooling: Independent lines per group. No information sharing β€” overfitting with small n_j.

Partial Pooling (Mixed Model): The golden middle ground. Group-specific estimates are pulled toward the grand mean (Shrinkage). Groups with little data are pulled more strongly β€” the model "trusts" them less.
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.

Shrinkage factor Ξ» = Ο„β‚€Β² / (Ο„β‚€Β² + σ²/n_j)

Determines how strongly the group-specific estimate is pulled toward the grand mean. With small n_j or small Ο„β‚€ β†’ strong shrinkage. Visible in the shrinkage diagram as arrow length.
Simpson's Paradox
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.
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).
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()
β„Ή (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 grand mean

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.

Simpson warning: appears when Complete Pooling reverses the direction of the slope β€” the classic Simpson's Paradox.
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