cooks.distance.rlmerMod: Cook's-distance equivalent for an rlmerMod fit (per...

View source: R/influence_full.R

cooks.distance.rlmerModR Documentation

Cook's-distance equivalent for an rlmerMod fit (per observation or per cluster).

Description

Joint Mahalanobis influence on the fitted (\hat{\beta}, \hat{\sigma}, \hat{\theta}). With groups = NULL (default) the unit is the observation: the per-observation influence vectors are stacked into a (p + 1 + L) \times n matrix W, and the result is \sqrt{w_i^T V^{-1} w_i} with V = (1/n) W W^T. With groups set the unit is the cluster: the per-cluster influence functions \Xi = -J_{par}^{-1} S (S the per-cluster score contributions from .scoreByCluster), restricted to the (\beta, \sigma, \theta) rows, are scored the same way with V = (1/J) \Xi \Xi^T. This flags whole-cluster outliers that no single observation reveals – e.g. before relying on the bootstrap variance-component test of anova, which is anti-conservative under group contamination. If V is singular (a variance-component boundary) the Moore-Penrose pseudo-inverse is used.

Usage

## S3 method for class 'rlmerMod'
cooks.distance(model, groups = NULL, IF = NULL, ...)

Arguments

model

An rlmerMod object.

groups

Cluster grouping for cluster-level Cook's distance: NULL (default) for per-observation; TRUE for the top-level grouping factor; or a factor / grouping-factor name to aggregate over. Cluster-level requires a single or nested grouping structure (crossed designs error, as for the variance-parameter covariance).

IF

Optional pre-computed implicitIF_full(model); computed on demand if NULL.

...

Currently unused.

Details

The full IF computation is the expensive part; pre-compute it once via IF = implicitIF_full(fit) and pass it in if you need cooks.distance and influence together.

Value

Named numeric vector: one entry per observation (groups = NULL) or per cluster level.

See Also

implicitIF_full, influence, hatvalues


robustlmm documentation built on July 30, 2026, 5:11 p.m.