This function calculates the leverage of
a hierarchical linear model fit by lmer
.
# S3 method for default leverage(object, ...) # S3 method for mer leverage(object, level = 1, ...) # S3 method for lmerMod leverage(object, level = 1, ...) # S3 method for lme leverage(object, level = 1, ...)
object | fitted object of class |
---|---|
... | do not use |
level | the level at which the leverage should be calculated: either
1 for observation level leverage (default) or the name of the grouping factor
(as defined in |
leverage
returns a data frame with the following columns:
overall
The overall leverage, i.e. \(H = H_1 + H_2\).
fixef
The leverage corresponding to the fixed effects.
ranef
The leverage corresponding to the random effects proposed by Demidenko and Stukel (2005).
ranef.uc
The (unconfounded) leverage corresponding to the random effects proposed by Nobre and Singer (2011).
Demidenko and Stukel (2005) describe leverage for mixed (hierarchical) linear models as being the sum of two components, a leverage associated with the fixed (\(H_1\)) and a leverage associated with the random effects (\(H_2\)) where $$H_1 = X (X^\prime V^{-1} X)^{-1} X^\prime V^{-1}$$ and $$H_2 = ZDZ^{\prime} V^{-1} (I - H_1)$$ Nobre and Singer (2011) propose using $$H_2^* = ZDZ^{\prime}$$ as the random effects leverage as it does not rely on the fixed effects.
For individual observations leverage
uses the diagonal elements of the
above matrices as the measure of leverage. For higher-level units,
leverage
uses the mean trace of the above matrices associated with each
higher-level unit.
Demidenko, E., & Stukel, T. A. (2005) Influence analysis for linear mixed-effects models. Statistics in Medicine, 24(6), 893--909.
Nobre, J. S., & Singer, J. M. (2011) Leverage analysis for linear mixed models. Journal of Applied Statistics, 38(5), 1063--1072.
Adam Loy loyad01@gmail.com
data(sleepstudy, package = 'lme4') fm <- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy) # Observation level leverage lev1 <- leverage(fm, level = 1) head(lev1)#> overall fixef ranef ranef.uc #> 1 0.22930404 0.019191919 0.21011212 0.9345897 #> 2 0.16972999 0.013804714 0.15592528 1.0174683 #> 3 0.12682372 0.009764310 0.11705941 1.2074459 #> 4 0.10058520 0.007070707 0.09351449 1.5045226 #> 5 0.09101445 0.005723906 0.08529055 1.9086983 #> 6 0.09811147 0.005723906 0.09238756 2.4199730#> overall fixef ranef ranef.uc #> 1 0.161234 0.01111111 0.1501229 2.592732 #> 2 0.161234 0.01111111 0.1501229 2.592732 #> 3 0.161234 0.01111111 0.1501229 2.592732 #> 4 0.161234 0.01111111 0.1501229 2.592732 #> 5 0.161234 0.01111111 0.1501229 2.592732 #> 6 0.161234 0.01111111 0.1501229 2.592732