influence.merMod | R Documentation |

These functions compute deletion influence diagnostics for linear
(fit by `lmer`

) and generalized linear mixed-effects models
(fit by `glmer`

). The main functions are methods for
the `influence`

generic function. Other functions are
provided for computing `dfbeta`

, `dfbetas`

,
`cooks.distance`

, and influence on variance-covariance
components based on the objects computed by `influence.merMod`

```
## S3 method for class 'merMod'
influence(model, groups, data, maxfun = 1000,
do.coef = TRUE, ncores = getOption("mc.cores",1), start, ...)
## S3 method for class 'influence.merMod'
cooks.distance(model, ...)
## S3 method for class 'influence.merMod'
dfbeta(model, which = c("fixed", "var.cov"), ...)
## S3 method for class 'influence.merMod'
dfbetas(model, ...)
```

`model` |
in the case of |

`groups` |
a character vector containing the name of a grouping factor or names of grouping factors; if more than one name is supplied, then groups are defined by all combinations of levels of the grouping factors that appear in the data. If omitted, then each individual row of the data matrix is treated as a "group" to be deleted in turn. |

`data` |
an optional data frame with the data to which |

`maxfun` |
The maximum number of function evaluations (for |

`which` |
if |

`do.coef` |
if |

`ncores` |
number of computational cores to use if run in parallel;
directly passed to |

`start` |
starting value for new fits (set to optimal values from original fit by default) |

`...` |
ignored. |

`influence.merMod`

start with the estimated variance-covariance components from `model`

and then refit
the model omitting each group in turn, not necessarily iterating to completion. For example, `maxfun=20`

takes up to 20 function evaluations
step away from the ML or REML solution for the full data, which usually provides decent approximations to the fully iterated estimates.

The other functions are methods for the `dfbeta`

, `dfbetas`

, and `cooks.distance`

generics, to be applied to the
`"influence.merMod"`

object produced by the `influence`

function; the `dfbeta`

methods can also return
influence on the variance-covariance components.

`influence.merMod`

returns objects of class
`"influence.merMod"`

, which contain the following elements:

`"fixed.effects"`

the estimated fixed effects for the model.

`"fixed.effects[-groups]"`

a matrix with columns corresponding to the fixed-effects coefficients and rows corresponding to groups, giving the estimated fixed effects with each group deleted in turn;

*groups*is formed from the name(s) of the grouping factor(s).`"var.cov.comps"`

the estimated variance-covariance parameters for the model.

`"var.cov.comps[-groups]"`

a matrix with the estimated covariance parameters (in columns) with each group deleted in turn.

`"vcov"`

The estimated covariance matrix of the fixed-effects coefficients.

`"vcov[-groups]"`

a list each of whose elements is the estimated covariance matrix of the fixed-effects coefficients with one group deleted.

`"groups"`

a character vector giving the names of the grouping factors.

`"deleted"`

the possibly composite grouping factor, each of whose elements is deleted in turn.

`"converged"`

for

`influence.merMod`

, a logical vector indicating whether the computation converged for each group.`"function.evals"`

for

`influence.merMod`

, a vector of the number of function evaluations performed for each group.

For plotting `"influence.merMod"`

objects, see `infIndexPlot`

.

J. Fox jfox@mcmaster.ca

Fox, J. and Weisberg, S. (2019)
*An R Companion to Applied Regression*, Third Edition, Sage.

`infIndexPlot`

, `influence.measures`

```
if (interactive()) {
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
inf_fm1 <- influence(fm1, "Subject")
if (require("car")) {
infIndexPlot(inf_fm1)
}
dfbeta(inf_fm1)
dfbetas(inf_fm1)
gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial)
inf_gm1 <- influence(gm1, "herd", maxfun=100)
gm1.11 <- update(gm1, subset = herd != 11) # check deleting herd 11
if (require("car")) {
infIndexPlot(inf_gm1)
compareCoefs(gm1, gm1.11)
}
if(packageVersion("car") >= "3.0.10") {
dfbeta(inf_gm1)
dfbetas(inf_gm1)
}
}
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.