Home / Shared Math Details / MSA / Restricted Maximum Likelihood
Restricted Maximum Likelihood¶
This page defines what the restricted maximum likelihood method estimates and what it reports. It is the method the Automatic setting chooses when the data are not balanced, and it is the only method that reports confidence intervals on unbalanced data.
The components it produces are then handled exactly as Variance Components describes.
Notation¶
| Term | Description |
|---|---|
| \(\boldsymbol{\theta}\) | the collection of variance components being estimated |
| \(\mathbf{V}\) | the variance matrix of the observations implied by \(\boldsymbol{\theta}\) |
| \(\mathbf{X}\) | the fixed effects design |
| \(\mathbf{y}\) | the observations |
| \(\mathbf{P}\) | the projection that removes the fixed effects |
| \(n\) | the number of observations used |
| \(q\) | the number of fixed effects in the model |
| \(\ell_R\) | the restricted log-likelihood |
What the method does¶
Restricted maximum likelihood, abbreviated REML, estimates every variance component in the model at once, from the data as a whole, rather than solving for them from an analysis of variance table. It is the method the Automatic setting chooses when the data are not balanced.
What is maximised¶
The method chooses the variance components that maximise the restricted likelihood. The engine works with that likelihood on the \(-2\log\) scale, so it makes the following criterion as small as possible, and it is this criterion that the report publishes:
The pieces are:
| Symbol | Meaning |
|---|---|
| \(n\) | the number of observations used |
| \(q\) | the number of fixed effects in the model |
| \(\mathbf{V}\) | the variance matrix of the observations implied by the current variance components |
| \(\mathbf{X}\) | the fixed effects design |
| \(\mathbf{y}\) | the observations |
| \(\mathbf{P}\) | \(\mathbf{V}^{-1} - \mathbf{V}^{-1}\mathbf{X}(\mathbf{X}^{\top}\mathbf{V}^{-1}\mathbf{X})^{-1}\mathbf{X}^{\top}\mathbf{V}^{-1}\), which removes the fixed effects |
The final term \(\mathbf{y}^{\top}\mathbf{P}\mathbf{y}\) is the sum of squares that remains after the fixed effects have been fitted at the current variance components.
Two of those four terms are what the word "restricted" refers to. Ordinary maximum likelihood uses the same expression with \(n\) in place of \(n - q\) and without the \(\ln\lvert \mathbf{X}^{\top}\mathbf{V}^{-1}\mathbf{X} \rvert\) term at all. Estimating the fixed effects and the variance components together that way leaves the variance estimates systematically too small, because they take no account of the degrees of freedom spent on the fixed effects. The extra determinant term and the reduced count are what account for it.
REML and expected mean squares do not always agree, even on balanced data. Expected mean squares removes an interaction whose p-value is above the removal alpha (0.25 by default) and pools it into repeatability. REML never removes a term: the interaction stays in the model and gets its own component. On a balanced study whose interaction estimate is positive but not significant, the two methods therefore report different repeatability and reproducibility.
Because the criterion is on the \(-2\log\) scale, a smaller reported value is a better fit.
Which terms enter the fit¶
The terms that enter the fit are exactly the terms of the declared model, and nothing is added or dropped by the method itself:
- one term per declared factor main effect
- each interaction left checked on the Model tab
- each nesting relationship declared on the Model tab, which changes what a term's levels are rather than adding a term
- the residual
A factor declared Fixed enters as a fixed effect, so it contributes to \(\mathbf{X}\) and has no variance component estimated for it. At least one term must be random. A model in which every factor is declared fixed leaves REML with no variance to estimate, and the engine refuses it with a named reason rather than returning zeros; the expected mean squares method reports the same study.
The non-negativity constraint¶
The components are estimated under the constraint that a variance cannot be negative. This is the substantive difference between REML and the expected mean squares method, and it shows up directly on the report:
- Under expected mean squares a component's moment estimate can come out negative, and zero is reported in its place with a footnote saying so.
- Under REML nothing negative is ever computed. A reported zero means the constrained estimate reached the zero boundary, and the footnote says that instead.
The product itself points a reader from the first case to the second: the expected mean squares footnote suggests considering the REML method precisely because it constrains the components to be non-negative.
What is reported about the fit¶
The report does not print any numbers about the fit itself, such as the criterion value or whether the solver converged. A fit that fails is refused with a message rather than reported. What does change on the report under this method:
- There is no ANOVA table. The method does not build one.
- No term is removed. The Part × Operator interaction stays in the Gage R&R Results table, under Reproducibility, even when its estimate is zero.
- A component at zero is marked with an asterisk, and the footnote reads This variance component was estimated as zero. REML constrains variance components to be non-negative, and this estimate reached that boundary.
The model REML cannot fit¶
REML cannot fit a model containing a term that involves more than three factors once nesting is counted. Nesting counts here because a nested term carries its parents with it, so a term that looks like two factors in the dialog can involve four once its nesting chain is followed.
When the declared model crosses that limit, the analysis uses the expected mean squares method instead, whether REML was chosen directly or reached through Automatic. The Model tab warns about this before the analysis is run, in these words:
A term in this model involves more than three factors once nesting is counted, so the REML method cannot fit it; if REML is selected or chosen automatically, the analysis will use expected mean squares instead.
The Estimation method: row of the report states the method that was actually used, so the substitution is visible afterwards as well as being warned about beforehand.
Which intervals it reports¶
REML reports confidence intervals on balanced and unbalanced data alike, which is the main way it differs from expected mean squares on the interval table. Three gaps remain, and all are absences a reader will notice on the report:
- The % Contribution columns are left out of the confidence interval table under this method, so the table shows Variance, Std Dev, Study Var and % Tolerance bounds only.
- A component estimated at zero has no interval. Its row in the confidence interval table is left blank.
- An aggregate row (Total Gage R&R, Reproducibility total, Part to part total, Total Variation) reports no interval when the separately computed aggregate block is unavailable, or when one of its member components has no interval of its own.
The number of distinct categories carries no interval under this method.
See Also¶
- Variance Components, what the fit produces and how it is grouped
- Expected Mean Squares, the method used instead when this one cannot fit the model, and the one whose negative estimates this method's constraint avoids