This function is used to compute influence diagnostics for a hierarchical linear model.
It takes a model fit as a lmerMod
object or as a lme
object and returns a tibble with Cook's
distance, MDFFITS, covtrace, covratio, and leverage.
# S3 method for default hlm_influence(model, ...) # S3 method for lmerMod hlm_influence( model, level = 1, delete = NULL, approx = TRUE, leverage = "overall", data = NULL, ... ) # S3 method for lme hlm_influence( model, level = 1, delete = NULL, approx = TRUE, leverage = "overall", ... )
model | an object of class |
---|---|
... | not in use |
level | used to define the group for which cases are deleted and influence
diagnostics are calculated. If |
delete | numeric index of individual cases to be deleted. If the |
approx | logical parameter used to determine how the influence diagnostics are calculated.
If |
leverage | a character vector to determine which types of leverage should be included in the
returned tibble. There are four options: 'overall' (default), 'fixef', 'ranef', or 'ranef.uc'.
One or more types may be specified. For additional information about the types of leverage, see
|
data | (optional) the data frame used to fit the model. This is only necessary for |
The hlm_influence
function provides a wrapper that appends influence diagnostics
to the original data. The approximated influence diagnostics returned by this
function are equivalent to those returned by cooks.distance
, mdffits
, covtrace
,
covratio
, and leverage
. The exact influence diagnostics obtained through a full
refit of the data are also available through case_delete
and the accompanying functions
cooks.distance
, mdffits
, covtrace
, and covratio
that can be called
directly on the case_delete
object.
It is possible to set level
and delete individual cases from different groups using
delete
, so numeric indices should be double checked to confirm that they encompass entire groups.
Additionally, if delete
is specified, leverage values are not returned in the resulting tibble.