cr.plots {car}R Documentation

Component+Residual (Partial Residual) Plots

Description

These functions construct component+residual plots (also called partial-residual plots) for linear and generalized linear models.

Usage

cr.plots(model, variable, ask=missing(variable), one.page=!ask, 
  span=0.5, ...)

crp(...)

cr.plot(model, ...)

## S3 method for class 'lm':
cr.plot(model, variable, order=1, line=TRUE, smooth=TRUE, iter, 
  span=0.5, las=par('las'), col=palette()[2], pch=1, lwd=2,
  main="Component+Residual Plot", ...)

## S3 method for class 'glm':
cr.plot(model, ...)

Arguments

model model object produced by lm or glm.
variable variable (if it exists in the search path) or name of variable. This argument usually is omitted for crp or cr.plots.
ask if TRUE, a menu is provided in the R Console for the user to select the variable(s) to plot, and to modify the span for the smoother used to draw a nonparametric-regression line on the plot.
one.page if TRUE (and ask=FALSE), put all plots on one graph.
order order of polynomial regression performed for predictor to be plotted.
line TRUE to plot least-squares line.
smooth TRUE to plot nonparametric-regression (lowess) line.
iter number of robustness iterations for nonparametric-regression smooth; defaults to 3 for a linear model and to 0 for a non-Gaussian glm.
span span for lowess smoother.
las if 0, ticks labels are drawn parallel to the axis; set to 1 for horizontal labels (see par).
col color for points and lines; the default is the second entry in the current color palette (see palette and par).
pch plotting character for points; default is 1 (a circle, see par).
lwd line width; default is 2 (see par).
main title for plot.
... pass arguments down.

Details

The function intended for direct use is cr.plots (for which crp is an abbreviation). By default, these functions are used interactively through a text menu.

The model cannot contain interactions, but can contain factors. Parallel boxplots of the partial residuals are drawn for the levels of a factor.

Value

NULL. These functions are used for their side effect: producing plots.

Author(s)

John Fox jfox@mcmaster.ca

References

Cook, R. D. and Weisberg, S. (1999) Applied Regression, Including Computing and Graphics. Wiley.

Fox, J. (1997) Applied Regression, Linear Models, and Related Methods. Sage.

See Also

ceres.plots, av.plots

Examples

cr.plots(lm(prestige~income+education, data=Prestige), 
  variable="income")
  ## Not run: 
cr.plots(glm(partic != "not.work" ~ hincome + children, 
  data=Womenlf, family=binomial))
  
## End(Not run)

[Package car version 1.1-0 Index]