Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cooks.distance.glmgee

Cook's Distance for Generalized Estimating Equations


Description

Produces an approximation, better known as the one-step aproximation, of the Cook's distance, which is aimed to measure the effect on the estimates of the parameters in the linear predictor of deleting each cluster in turn. This function also can produce a cluster-index plot of the Cook's distance for all parameters in the linear predictor or for some subset of them.

Usage

## S3 method for class 'glmgee'
cooks.distance(model, plot.it = TRUE, coefs, identify, ...)

Arguments

model

an object of class glmgee obtained from the fit of a generalized estimating equation.

plot.it

an (optional) logical indicating if the plot of Cook's distance is required or just the data matrix in which that plot is based. By default, plot.it is set to be TRUE.

coefs

an (optional) character string which (partially) match with the names of some of the parameters in the linear predictor.

identify

an (optional) integer indicating the number of clusters to identify on the plot of Cook's distance. This is only appropriate if plot.it=TRUE.

...

further arguments passed to or from other methods. If plot.it=TRUE then ... may be used to include graphical parameters to customize the plot. For example, col, pch, cex, main, sub, xlab, ylab.

Details

The Cook's distance consists of the distance between two estimates of the parameters in the linear predictor using a metric based on the (estimate of the) variance-covariance matrix. The first one set of estimates is computed from a dataset including all clusters, and the second one is computed from a dataset in which the i-th cluster is excluded. To avoid computational burden, the second set of estimates is replaced by its one-step approximation. See the dfbeta.glmgee documentation.

Value

A matrix as many rows as clusters in the sample and one column with the values of the Cook's distance.

Examples

## Cook's distance for all parameters in the linear predictor
mod <- size ~ poly(days,4) + treat
fit <- glmgee(mod, id=tree, family=Gamma("log"), data=spruce, corstr="Exchangeable")
cooks.distance(fit, col="red", lty=1, lwd=1, col.lab="blue", main="Cook's distance",
               col.axis="blue", col.main="black", family="mono", cex=0.8)

## Cook's distance for the parameter associated to the variable treat
cooks.distance(fit, coef="treat", col="red", lty=1, lwd=1, col.lab="blue",
               main="Cook's distance", col.axis="blue", col.main="black",
               family="mono", cex=0.8)

glmtoolbox

Set of Tools to Data Analysis using Generalized Linear Models

v0.1.0
GPL-2 | GPL-3
Authors
Luis Hernando Vanegas [aut, cre], Luz Marina Rondón [aut], Gilberto A. Paula [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.