There are two types of \(R_{GLMM}^{2}\): marginal and conditional.
Marginal \(R_{GLMM}^{2}\) represents the variance explained by the fixed
effects, and is defined as:
$$R_{GLMM(m)}^{2}= \frac{\sigma_f^2}{\sigma_f^2 + \sigma_{\alpha}^2 + \sigma_{\varepsilon }^2}
$$
Conditional \(R_{GLMM}^{2}\) represents the variance explained by the
entire model, including both fixed and random effects. It is calculated
by the equation:
$$R_{GLMM(c)}^{2}= \frac{\sigma_f^2 + \sigma_{\alpha}^2}{\sigma_f^2 + \sigma_{\alpha}^2 + \sigma_{\varepsilon }^2}
$$
where \(\sigma_f^2\)
is the variance of the fixed effect components,
\(\sigma_{\alpha}\)
is the variance of the random effects, and
\(\sigma_\epsilon^2\)
is the “observation-level” variance.
Three methods are available for deriving the observation-level variance
\(\sigma_\varepsilon\): the delta method, lognormal approximation and using the
trigamma function.
The delta method can be used with for all distributions and link functions,
while lognormal approximation and trigamma function are limited to distributions
with logarithmic link. Trigamma-estimate is recommended whenever available.
Additionally, for binomial distributions, theoretical variances exist
specific for each link function distribution.
Null model. Calculation of the observation-level variance involves in
some cases fitting a null model containing no fixed effects other than
intercept, otherwise identical to the original model (including all the random
effects). When using r.squaredGLMM
for several models differing only in
their fixed effects, in order to avoid redundant calculations, the null model
object can be passed as the argument null
.
Otherwise, a null model will be fitted via updating the original model.
This assumes that all the variables used in the original model call have the
same values as when the model was fitted. The function warns about this when
fitting the null model is required. This warnings can be disabled by setting
options(MuMIn.noUpdateWarning = TRUE)
.