Last data update: 2014.03.03

R: Case Deletion for 'mer'/'lmerMod' objects
case_delete.defaultR Documentation

Case Deletion for mer/lmerMod objects

Description

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.

Usage

## Default S3 method:
case_delete(model, ...)

## S3 method for class 'mer'
case_delete(model, group = NULL, type = c("both", "fixef",
  "varcomp"), delete = NULL, ...)

## S3 method for class 'lmerMod'
case_delete(model, group = NULL, type = c("both", "fixef",
  "varcomp"), delete = NULL, ...)

Arguments

model

the original hierarchical model fit using lmer()

...

do not use

group

a variable used to define the group for which cases will be deleted. If this is left NULL (default), then the function will delete individual observations.

type

the part of the model for which you are obtaining deletion diagnostics: the fixed effects ("fixef"), variance components ("varcomp"), or "both" (default).

delete

index of individual cases to be deleted. For higher level units specified in this manner, the group parameter must also be specified. If delete = NULL then all cases are iteratively deleted.

Value

a list with the following compontents:

fixef.original

the original fixed effects estimates

ranef.original

the original predicted random effects

vcov.original

the original variance-covariance matrix for the fixed effects

varcomp.original

the original estimated variance components

fixef.delete

a list of the fixed effects estimated after case deletion

ranef.delete

a list of the random effects predicted after case deletion

vcov.delete

a list of the variance-covariance matrices for the fixed effects obtained after case deletion

fitted.delete

a list of the fitted values obtained after case deletion

varcomp.delete

a list of the estimated variance components obtained after case deletion

Author(s)

Adam Loy loyad01@gmail.com

References

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.

Examples

library(lme4)
data(sleepstudy, package = 'lme4')
fm <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)

# Deleting every Subject
fmDel <- case_delete(model = fm, group = "Subject", type = "both")

# Deleting only subject 308
del308 <- case_delete(model = fm, group = "Subject", type = "both", delete = 308)

# Deleting a subset of subjects
delSubset <- case_delete(model = fm, group = "Subject", type = "both", delete = 308:310)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(HLMdiag)

Attaching package: 'HLMdiag'

The following object is masked from 'package:stats':

    covratio

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HLMdiag/case_delete.mer.Rd_%03d_medium.png", width=480, height=480)
> ### Name: case_delete.default
> ### Title: Case Deletion for 'mer'/'lmerMod' objects
> ### Aliases: case_delete case_delete.default case_delete.lmerMod
> ###   case_delete.mer
> ### Keywords: models regression
> 
> ### ** Examples
> 
> library(lme4)
Loading required package: Matrix
> data(sleepstudy, package = 'lme4')
> fm <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
> 
> # Deleting every Subject
> fmDel <- case_delete(model = fm, group = "Subject", type = "both")
> 
> # Deleting only subject 308
> del308 <- case_delete(model = fm, group = "Subject", type = "both", delete = 308)
> 
> # Deleting a subset of subjects
> delSubset <- case_delete(model = fm, group = "Subject", type = "both", delete = 308:310)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>