This function is used to iteratively delete groups corresponding to the
levels of a hierarchical linear model. It uses lmer() to fit
the models for each deleted case (i.e. uses brute force). To investigate
numerous levels of the model, the function will need to be called multiple
times, specifying the group (level) of interest each time.
# S3 method for default case_delete(model, ...) # S3 method for mer case_delete( model, level = 1, type = c("both", "fixef", "varcomp"), delete = NULL, ... ) # S3 method for lmerMod case_delete( model, level = 1, type = c("both", "fixef", "varcomp"), delete = NULL, ... ) # S3 method for lme case_delete( model, level = 1, type = c("both", "fixef", "varcomp"), delete = NULL, ... )
| model | the original hierarchical model fit using |
|---|---|
| ... | do not use |
| level | a variable used to define the group for which cases will be
deleted. If |
| type | the part of the model for which you are obtaining deletion
diagnostics: the fixed effects ( |
| delete | numeric index of individual cases to be deleted. If the |
a list with the following components:
fixef.originalthe original fixed effects estimates
ranef.originalthe original predicted random effects
vcov.originalthe original variance-covariance matrix for the fixed effects
varcomp.originalthe original estimated variance components
fixef.deletea list of the fixed effects estimated after case deletion
ranef.deletea list of the random effects predicted after case deletion
vcov.deletea list of the variance-covariance matrices for the fixed effects obtained after case deletion
fitted.deletea list of the fitted values obtained after case deletion
varcomp.deletea list of the estimated variance components obtained after case deletion
Christensen, R., Pearson, L.M., and Johnson, W. (1992) Case-Deletion Diagnostics for Mixed Models, Technometrics, 34, 38 -- 45.
Schabenberger, O. (2004) Mixed Model Influence Diagnostics, in Proceedings of the Twenty-Ninth SAS Users Group International Conference, SAS Users Group International.
Adam Loy loyad01@gmail.com
data(sleepstudy, package = 'lme4') fm <- lme4::lmer(Reaction ~ Days + (Days|Subject), sleepstudy) # Deleting every Subject fmDel <- case_delete(model = fm, level = "Subject", type = "both") # Deleting only subject 308 del308 <- case_delete(model = fm, level = "Subject", type = "both", delete = 308) # Deleting a subset of subjects delSubset <- case_delete(model = fm, level = "Subject", type = "both", delete = 308:310)