plot.nlreg.diag {nlreg} | R Documentation |
Diagnostic Plots for Nonlinear Heteroscedastic Models
Description
The nlreg.diag.plots
routine generates diagnostic plots for a
nonlinear heteroscedastic model using different types of residuals,
influence measures and leverages. This is equivalent to using the
plot.nlreg.diag
method for function
plot
for objects inheriting from class
nlreg.diag
.
Usage
nlreg.diag.plots(fitted, which = "all", subset = NULL, iden = FALSE,
labels = NULL, hoa = TRUE, infl = TRUE,
trace = FALSE, ret = FALSE, ...)
## S3 method for class 'nlreg.diag'
plot(x, which = "all", subset = NULL, iden = FALSE, labels = NULL,
...)
Arguments
fitted |
either a |
x |
a |
which |
which plot to draw. Admissible values are |
subset |
the subset of the data used in the original |
iden |
logical argument. If |
labels |
a vector of labels for use with |
hoa |
logical value indicating whether higher order asymptotics should be
used for calculating the regression diagnostics. Needed only if
|
infl |
logical value indicating whether influence measures should be
calculated on the basis of a leave-one-out analysis. Needed only
if |
trace |
logical value. If |
ret |
logical argument indicating whether the |
... |
additional graphics parameters. |
Details
The diagnostics required for the plots are calculated by
nlreg.diag
, either by passing a
nlreg.diag
object or by applying nlreg.diag
internally to the nlreg
object specified through fitted
.
These are then used to produce the plots on the current graphics
device. A menu lists all possible choices. They may be one or all
of the following.
Make a plot selection (or 0 to exit) 1:plot: Summary 2:plot: Studentized residuals against fitted values 3:plot: r* residuals against fitted values 4:plot: Normal QQ-plot of studentized residuals 5:plot: Normal QQ-plot of r* residuals 6:plot: Cook statistic against h/(1-h) 7:plot: Global influence against h/(1-h) 8:plot: Cook statistic against observation number 9:plot: Influence measures against observation number Selection:
In the normal scores plots, the dotted line represents the expected line if the residuals are normally distributed, that is, it is the line with intercept 0 and slope 1.
In general, when plotting Cook's distance or the global influence
measure 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 regression coefficients
estimated. 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.
Value
If ret = TRUE
, the nlreg.diag
object is returned.
Otherwise, there is no returned value.
Side Effects
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.
Acknowledgments
This function is based on A. J. Canty's function
glm.diag.plots
contained in library boot
.
Note
Choices 3
and 5
are not available if hoa = FALSE
in the call to nlreg.diag
that generated the
x
argument.
Choices 7
and 9
are not available if
infl = FALSE
in the same call. Plot number 9
is
furthermore not available if the variance function is constant.
References
Brazzale, A. R. (2000) Practical Small-Sample Parametric Inference. Ph.D. Thesis N. 2230, Department of Mathematics, Swiss Federal Institute of Technology Lausanne. Section 6.3.1 and Appendix A.2.2.
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.
Davison, A. C. and Tsai, C.-L. (1992) Regression model diagnostics. Int. Stat. Rev., 60, 337–353.
See Also
nlreg.diag
, nlreg.object
,
identify
Examples
library(boot)
data(calcium)
calcium.nl <- nlreg( cal ~ b0*(1-exp(-b1*time)), weights = ~ ( 1+time^g )^2,
start = c(b0 = 4, b1 = 0.1, g = 1), data = calcium,
hoa = TRUE )
##
calcium.diag <- nlreg.diag( calcium.nl, trace = TRUE )
##
## menu-driven
## Not run:
plot( calcium.diag )
##
## Make a plot selection (or 0 to exit)
##
## 1:plot: Summary
## 2:plot: Studentized residuals against fitted values
## 3:plot: r* residuals against fitted values
## 4:plot: Normal QQ-plot of studentized residuals
## 5:plot: Normal QQ-plot of r* residuals
## 6:plot: Cook statistic against h/(1-h)
## 7:plot: Global influence against h/(1-h)
## 8:plot: Cook statistic against observation number
## 9:plot: Influence measures against observation number
##
## Selection:
## End(Not run)
##
## plot 5: Normal QQ-plot of r* residuals
plot( calcium.diag, which = 5, las = 1 )
##
nlreg.diag.plots( calcium.nl, which = 5, las = 1 )