🤖 AI Summary
This study clarifies the fundamental distinction between restricted maximum likelihood (REML) and maximum likelihood (ML) estimation in linear mixed models. Within the EM algorithm framework, the two methods differ solely in their treatment of the covariance matrix during variance component updates: REML employs the prediction error covariance—corresponding to Henderson’s C matrix—whereas ML uses the conditional covariance. This work is the first to explicitly interpret REML’s computational rationale through the lens of prediction error covariance and provides concise R code to transparently illustrate the key matrices involved. The implemented algorithm successfully reproduces both ML and REML results from the lme4 package, clearly exposing the core difference in their covariance structures and offering a reproducible, pedagogically valuable tool for understanding and teaching these estimation methods.
📝 Abstract
We present a computational motivation for restricted maximum likelihood (REML) estimation in linear mixed models using an expectation--maximization (EM) algorithm. At each iteration, maximum likelihood (ML) and REML solve the same mixed-model equations for the best linear unbiased estimator (BLUE) of the fixed effects and the best linear unbiased predictor (BLUP) of the random effects. They differ only in the trace adjustments used in the variance-component updates: ML uses conditional covariances of the random effects given the data, whereas REML uses prediction-error covariances from Henderson's C-matrix, reflecting uncertainty from estimating the fixed effects. Short R code makes this switch explicit, exposes the key matrices for classroom inspection, and reproduces lme4 ML and REML fits.