R: Outline an approximate pairwise confidence region
ellipse.glm
R Documentation
Outline an approximate pairwise confidence region
Description
This function produces the ellipsoidal outline of an approximate
pairwise confidence region for a generalized linear model fit.
Usage
## S3 method for class 'glm'
ellipse(x, which = c(1, 2), level = 0.95, t, npoints = 100,
dispersion, ...)
Arguments
x
The first argument should be a glm object, usually resulting from a call
to glm().
which
Which selects the pair of parameters to be plotted. The default is the
first two.
level
The confidence level of the region. Default 95%.
t
The t statistic on the boundary of the ellipse. For Binomial or Poisson
families, sqrt(qchisq(level, 2)) is used; for other distributions,
sqrt(2*qf(level, 2, df)) where df is the residual degrees of freedom.
npoints
How many points to return in the ellipse.
dispersion
The value of dispersion to use. If specified, it is treated as fixed,
and the chi-square limits for t are used. If missing, it is
taken from summary(x).
...
Other ellipse.default parameters may also be used.
Details
The summary function is used to obtain the approximate covariance matrix of the
fitted parameters, the dispersion estimate, and the degrees of freedom.
Value
A matrix with columns named according to which to outline the confidence region.
See Also
ellipse.default
Examples
## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
glm.D93 <- glm(counts ~ outcome + treatment, family=poisson())
# Plot an approximate 95 % confidence region for the two Outcome parameters
plot(ellipse(glm.D93, which = c(2,3)), type = 'l')
points(glm.D93$coefficients[2], glm.D93$coefficients[3])