plot.nlreg.diag: Diagnostic Plots for Nonlinear Heteroscedastic Models

Description Usage Arguments Details Value Side Effects Acknowledgments Note References See Also Examples

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

1
2
3
4
5
6
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 nlreg object, that is, the result of a call to nlreg, or a nlreg.diag object obtained from a call to nlreg.diag.

x

a nlreg.diag object obtained from a call to nlreg.diag.

which

which plot to draw. Admissible values are 2 to 9 which correspond to the choices below. The default is "all", which pops up a menu that lists all available plots.

subset

the subset of the data used in the original nlreg fit. Must be the same than the subset option used in the call to nlreg that generated the nlreg object for which the diagnostic plots are to be drawn. Needed only if the subset option is used in the call to nlreg.

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, the labels are derived from the nlreg.diag object argument fitted or x.

hoa

logical value indicating whether higher order asymptotics should be used for calculating the regression diagnostics. Needed only if fitted is a nlreg object. Default is TRUE.

infl

logical value indicating whether influence measures should be calculated on the basis of a leave-one-out analysis. Needed only if fitted is a nlreg object. Default is TRUE.

trace

logical value. If TRUE details of the iterations are printed. Needed only if fitted is a nlreg object. Default is FALSE.

ret

logical argument indicating whether the nlreg.diag object should be returned; the default is FALSE.

...

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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 )

hoa documentation built on May 2, 2019, 8:56 a.m.