| HLMdiag {HLMdiag} | R Documentation |
Diagnostic tools for hierarchical (multilevel) linear models
Description
HLMdiag provides a suite of diagnostic tools for hierarchical
(multilevel) linear models fit using the lme4 or nlme
packages. These tools are grouped below by purpose.
See the help documentation for additional information
about each function.
Details
Residual analysis
HLMdiag's hlm_resid function provides a wrapper that
extracts residuals and fitted values for individual observations
or groups of observations. In addition to being a wrapper function for functions
implemented in the lme4 and nlme packages,
hlm_resid provides access to the marginal and least squares
residuals.
Influence analysis
HLMdiag's hlm_influence function provides a convenient wrapper
to obtain influence diagnostics for each observation or group of observations
appended to the data used to fit the model. The diagnostics returned by
hlm_influence include Cook's distance, MDFFITS, covariance trace (covtrace),
covariance ratio (covratio), leverage, and relative variance change (RVC).
HLMdiag also contains functions to calculate these diagnostics individually, as discussed below.
Influence on fitted values
HLMdiag provides leverage that calculates the influence
that observations/groups have on the fitted values (leverage).
For mixed/hierarchical models leverage can be decomposed into two parts: the
fixed part and the random part. We refer the user to the references
cited in the help documentation for additional explanation.
Influence on fixed effects estimates
HLMdiag provides cooks.distance and mdffits
to assess the influence of subsets of observations on the fixed effects.
Influence on precision of fixed effects
HLMdiag provides covratio and covtrace
to assess the influence of subsets of observations on the precision of
the fixed effects.
Influence on variance components
HLMdiag's rvc calculates the relative variance change to
assess the influence of subsets of observations on the variance
components.
Graphics
HLMdiag also strives to make graphical assessment easier in the
ggplot2 framework by providing dotplots for influence diagnostics
(dotplot_diag), grouped Q-Q plots (group_qqnorm),
and Q-Q plots that combine the functionality of qqnorm and
qqline (ggplot_qqnorm).