The {influence.ME} R package

The R package {influence.ME} allows you to compute measures of influential data for mixed effects models generated by {lme4}.

Tools for detecting influential data in mixed effects models

{influence.ME} provides a collection of tools for detecting influential cases in generalized mixed effects models. It analyses models that were estimated using lme4.

The basic rationale behind identifying influential data is that when iteratively single units are omitted from the data, models based on these data should not produce substantially different estimates.

To standardize the assessment of how influential a (single group of) observation(s) is, several measures of influence are common practice, such as DFBETAS and Cook's Distance.

In addition, we provide a measure of percentage change of the fixed point estimates and a simple procedure to detect changing levels of significance.

Simple Example

An example model:

library(lme4)
model <- lmer(mpg ~ disp + (1 | cyl), mtcars)
summary(model)
## Linear mixed model fit by REML ['lmerMod']
## Formula: mpg ~ disp + (1 | cyl)
##    Data: mtcars
## 
## REML criterion at convergence: 169.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.4968 -0.5869 -0.2111  0.3449  2.1788 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  cyl      (Intercept) 5.325    2.308   
##  Residual             8.686    2.947   
## Number of obs: 32, groups:  cyl, 3
## 
## Fixed effects:
##              Estimate Std. Error t value
## (Intercept) 27.681003   2.311040  11.978
## disp        -0.033410   0.008382  -3.986
## 
## Correlation of Fixed Effects:
##      (Intr)
## disp -0.783
plot(model ,pch=18)

The function influence() is the basis for all further steps:

library(influence.ME)
infl <- influence(model, obs = TRUE)

Calculate Cook's distance:

cooks.distance(infl)
##            [,1]
## 1  1.188769e-05
## 2  1.188769e-05
## 3  4.141827e-03
## 4  3.860290e-02
## 5  4.450617e-03
## 6  2.618237e-04
## 7  9.119842e-05
## 8  3.950915e-04
## 9  1.165906e-02
## 10 6.990174e-03
## 11 2.572286e-02
## 12 8.534498e-03
## 13 1.300049e-03
## 14 2.569173e-02
## 15 1.214220e-02
## 16 2.144616e-02
## 17 5.703268e-02
## 18 2.980576e-02
## 19 8.406620e-03
## 20 8.402686e-02
## 21 1.797222e-02
## 22 1.069944e-03
## 23 4.777175e-03
## 24 7.447788e-04
## 25 8.481690e-02
## 26 1.185647e-04
## 27 2.334161e-04
## 28 4.842596e-03
## 29 3.036344e-04
## 30 1.877487e-02
## 31 7.027727e-03
## 32 1.987854e-02

Plot Cook's distance:

plot(infl, which = "cook")