rsm.diag.plots {marg} | R Documentation |
Generates diagnostic plots for a regression-scale model using different types of residuals, Cook's distance and the leverages.
rsm.diag.plots(rsmfit, rsmdiag = NULL, weighting = NULL, which = NULL, subset = NULL, iden = FALSE, labels = NULL, ret = FALSE, ...) ## S3 method for class 'rsm': plot(x, ...)
rsmfit, x |
a rsm object, i.e. the result of a call to rsm .
|
rsmdiag |
the object returned by a call to rsm.diag containing the
regression diagnostics for the regression-scale model defined by
rsmfit . If not supplied, this object is created by
rsm.diag.plots and returned upon request (if
ret = TRUE ).
|
weighting |
character string; defines the weight matrix that should be used in
the calculation of the residuals and diagnostics. Possible
choices are "observed" , "score" , "deviance"
and "max" ; see Jorgensen (1984) for their
definition. Will only be used if the rsmdiag argument is
missing.
|
which |
which plot to print. Admissible values are 2 to 7
corresponding to the choices in the menu below.
|
subset |
subset of data used in the original rsm fit: should be
the same than the subset option used in the call to
rsm which generated rsmfit . Needed only if the
subset option was used in the call to rsm .
|
iden |
logical argument. If TRUE , the user will be prompted after
the plots are drawn. A positive integer will select a plot and
invoke identify() on that plot. After exiting
identify() , the user is again prompted, this loop
continuing until the user responds to the prompt with 0 .
If iden is FALSE (default) the user cannot
interact with the plots.
|
labels |
a vector of labels for use with identify() if
iden is TRUE . If it is not supplied, then the
labels are derived from rsmfit .
|
ret |
logical argument indicating if rsmdiag should be
returned; the default is FALSE .
|
... |
additional arguments such as graphical parameters. |
The diagnostics required for the plots are calculated by
rsm.diag
. These are then used to produce the plots
on the current graphics device.
A menu lists all the plots that can be produced. They may be one or all of the following:
Make a plot selection (or 0 to exit) 1: All 2: Response residuals against fitted values 3: Deviance residuals against fitted values 4: QQ-plot of deviance residuals 5: Normal QQ-plot of r* residuals 6: Cook statistic against h/(1-h) 7: Cook statistic against observation number Selection:
In the normal scores plots, the dotted line represents the expected line if the residuals are normally distributed, i.e. it is the line with intercept 0 and slope 1.
In general, when plotting Cook's distance against the standardized leverages, there will be two dotted lines on the plot. The horizontal line is at 8/(n-2p), where n is the number of observations and p is the number of estimated parameters. Points above this line may be points with high influence on the model. The vertical line is at 2p/(n-2p) and points to the right of this line have high leverage compared to the variance of the raw residual at that point. If all points are below the horizontal line or to the left of the vertical line then the line is not shown.
Use of iden = TRUE
is encouraged for proper exploration of
these plots as a guide to how well the model fits the data and
whether certain observations have an unduly large effect on
parameter estimates.
If ret
is TRUE
then the value of rsmdiag
is returned, otherwise there is no returned value.
The current device is cleared. If iden = TRUE
, interactive
identification of points is enabled. All screens are closed, but
not cleared, on termination of the function.
This function is based on A. J. Canty's function
glm.diag.plots
contained in the package boot.
Davison, A. C. and Snell, E. J. (1991) Residuals and diagnostics. In Statistical Theory and Modelling: In Honour of Sir David Cox (eds. D. V. Hinkley, N. Reid, and E. J. Snell), 83–106. London: Chapman & Hall, London.
Davison, A. C. and Tsai, C.-L. (1992) Regression model diagnostics. Int. Stat. Rev., 60, 337–353.
Jorgensen, B. (1984) The Delta Algorithm and GLIM. Int. Stat. Rev., 52, 283–300.
rsm.diag
, rsm.object
,
identify
## Sea Level Data data(venice) attach(venice) Year <- 1:51/51 c11 <- cos(2*pi*1:51/11) ; s11 <- sin(2*pi*1:51/11) c19 <- cos(2*pi*1:51/18.62) ; s19 <- sin(2*pi*1:51/18.62) venice.rsm <- rsm(sea ~ Year + I(Year^2) + c11 + s11 + c19 + s19, family = extreme) ## Not run: rsm.diag.plots(venice.rsm, which = 3) ## End(Not run) ## or ## Not run: plot(venice.rsm) ## End(Not run) ## menu-driven ## rsm.diag.plots(venice.rsm, which = 5, las = 1) ## normal QQ-plot of r* residuals ## Not run: rsm.diag.plots(venice.rsm, which = 7, iden = T, labels = paste(1931:1981)) ## End(Not run) ## year 1932 highly influential detach()