cooks.distance.gnm | R Documentation |
Produces an approximation of the Cook's distance, better known as the one-step approximation,
for measuring the effect of deleting each observation in turn on the estimates of the parameters in a linear
predictor. Additionally, this function can produce an index plot of Cook's distance for all or a subset of the
parameters in the linear predictor (via the argument coefs
).
## S3 method for class 'gnm'
cooks.distance(model, plot.it = FALSE, dispersion = NULL, coefs, identify, ...)
model |
an object of class gnm. |
plot.it |
an (optional) logical indicating if the plot is required or just the data matrix in which that
plot is based. As default, |
dispersion |
an (optional) value indicating the estimate of the dispersion parameter. As default, |
coefs |
an (optional) character string that matches (partially) some of the model parameter names. |
identify |
an (optional) integer indicating the number of individuals to identify on the plot of the Cook's
distance. This is only appropriate if |
... |
further arguments passed to or from other methods. If |
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 individuals, and the second one is computed from a dataset in which the i-th individual is excluded. To avoid computational burden, the second set of estimates is replaced by its one-step approximation. See the dfbeta.overglm documentation.
A matrix as many rows as individuals in the sample and one column with the values of the Cook's distance.
###### Example 1: The effects of fertilizers on coastal Bermuda grass
data(Grass)
fit1 <- gnm(Yield ~ b0 + b1/(Nitrogen + a1) + b2/(Phosphorus + a2) + b3/(Potassium + a3),
family=gaussian(inverse), start=c(b0=0.1,b1=13,b2=1,b3=1,a1=45,a2=15,a3=30), data=Grass)
cooks.distance(fit1, plot.it=TRUE, col="red", lty=1, lwd=1,
col.lab="blue", col.axis="blue", col.main="black", family="mono", cex=0.8)
###### Example 2: Assay of an Insecticide with a Synergist
data(Melanopus)
fit2 <- gnm(Killed/Exposed ~ b0 + b1*log(Insecticide-a1) + b2*Synergist/(a2 + Synergist),
family=binomial(logit), weights=Exposed, start=c(b0=-3,b1=1.2,a1=1.7,b2=1.7,a2=2),
data=Melanopus)
### Cook's distance just for the parameter "b1"
cooks.distance(fit2, plot.it=TRUE, coef="b1", col="red", lty=1, lwd=1,
col.lab="blue", col.axis="blue", col.main="black", family="mono", cex=0.8)
###### Example 3: Developmental rate of Drosophila melanogaster
data(Drosophila)
fit3 <- gnm(Duration ~ b0 + b1*Temp + b2/(Temp-a), family=Gamma(log),
start=c(b0=3,b1=-0.25,b2=-210,a=55), weights=Size, data=Drosophila)
cooks.distance(fit3, plot.it=TRUE, col="red", lty=1, lwd=1,
col.lab="blue", col.axis="blue", col.main="black", family="mono", cex=0.8)
###### Example 4: Radioimmunological Assay of Cortisol
data(Cortisol)
fit4 <- gnm(Y ~ b0 + (b1-b0)/(1 + exp(b2+ b3*lDose))^b4, family=Gamma(identity),
start=c(b0=130,b1=2800,b2=3,b3=3,b4=0.5), data=Cortisol)
cooks.distance(fit4, plot.it=TRUE, col="red", lty=1, lwd=1,
col.lab="blue", col.axis="blue", col.main="black", family="mono", cex=0.8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.