leverage.default {HLMdiag} | R Documentation |
Leverage for HLMs
Description
This function calculates the leverage of
a hierarchical linear model fit by lmer
.
Usage
## Default S3 method:
leverage(object, ...)
## S3 method for class 'mer'
leverage(object, level = 1, ...)
## S3 method for class 'lmerMod'
leverage(object, level = 1, ...)
## S3 method for class 'lme'
leverage(object, level = 1, ...)
Arguments
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 |
Details
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.
Value
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).
Author(s)
Adam Loy loyad01@gmail.com
References
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.
See Also
cooks.distance.mer
, mdffits.mer
,
covratio.mer
, covtrace.mer
, rvc.mer
Examples
data(sleepstudy, package = 'lme4')
fm <- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
# Observation level leverage
lev1 <- leverage(fm, level = 1)
head(lev1)
# Group level leverage
lev2 <- leverage(fm, level = "Subject")
head(lev2)