Variance Components — REML
Estimates the variance components directly from the restricted likelihood — including on unbalanced designs.
Description
REML (restricted maximum likelihood) estimates the components without the detour through expected mean squares: it maximises the likelihood of the data adjusted for the fixed effects. On a balanced design the result agrees with Henderson I for practical purposes; on an unbalanced one REML is the more dependable choice because it assumes no balance. The engine warms up with `REML_EM_WARMUP = 5` EM steps and then continues with average-information steps (`REML_MAX_ITER = 100`, `REML_TOL = 1e-8`, checked both absolutely and relatively). The AI step is constrained: components that would go negative are pinned at zero (active set) and released again only once their score turns positive — an unconstrained Newton step otherwise oscillates along the boundary and never converges. When the AI step is undefined at all, EM takes over for that iteration; if both fail the fit counts as not converged, never a silent stop. Fully aliased terms (ANOVA degrees of freedom 0) are dropped beforehand — they make the average-information matrix exactly singular. A constant response is detected and yields all-zero components instead of inventing one out of rounding noise. The row count is capped at `REML_MAX_ROWS = 500` because memory and runtime grow steeply — one n×n matrix inversion per iteration.
Formulas
Assumptions
- Effects are independent and normally distributed
- The model is identifiable — each component carries its own information
Limitations
- At most 500 rows (REML_MAX_ROWS) — memory grows quadratically
- Runtime: one n×n matrix inversion per iteration — at the row cap a fit takes several seconds
- Produces no ANOVA table: degrees of freedom and sums of squares are absent
- The likelihood surface of small unbalanced designs is flat — the result can depend on the starting value
- Fully aliased terms (zero degrees of freedom) are removed before the fit and reported with component 0
References
- Patterson & Thompson (1971), Recovery of Inter-Block Information, Biometrika 58(3)
- Gilmour, Thompson & Cullis (1995), Average Information REML, Biometrics 51(4)
- Searle, Casella & McCulloch (1992), Variance Components, Wiley