avPlots {car}R Documentation

Added-Variable Plots

Description

These functions construct added-variable (also called partial-regression) plots for linear and generalized linear models.

Usage

avPlots(model, terms= ~ ., intercept=FALSE, layout=NULL, ask, main, ...)

avp(...)

avPlot(model, ...)

## S3 method for class 'lm'
avPlot(model, variable,
    id.method = list(abs(residuals(model, type="pearson")), "x"),
    labels, 
    id.n= if(id.method[1]=="identify") Inf else 0,
    id.cex=1, id.col=palette()[1],
    col = palette()[1], col.lines = palette()[2],
    xlab, ylab, pch = 1, lwd = 2, 
    main="Added-variable Plot", grid=TRUE, ...)

## S3 method for class 'glm'
avPlot(model, variable, 
    id.method = list(abs(residuals(model, type="pearson")), "x"),
    labels,
    id.n=if(id.method[1]=="identify") Inf else 0,
    id.cex=1, id.col=palette()[1], 
    col = palette()[1], col.lines = palette()[2],
    xlab, ylab, pch = 1, lwd = 2,  type=c("Wang", "Weisberg"), 
    main="Added-variable Plot", grid=TRUE, ...)

Arguments

model model object produced by lm or glm.
terms A one-sided formula that specifies a subset of the predictors. One added-variable plot is drawn for each term. For example, the specification terms = ~.-X3 would plot against all terms except for X3. If this argument is a quoted name of one of the terms, the added-variable plot is drawn for that term only.
intercept Include the intercept in the plots; default is FALSE.
variable A quoted string giving the name of a regressor in the model matrix for the horizontal axis
layout If set to a value like c(1,1) or c(4,3), the layout of the graph will have this many rows and columns. If not set, the program will select an appropriate layout. If the number of graphs exceed nine, you must select the layout yourself, or you will get a maximum of nine per page.
main The title of the plot; if missing, one will be supplied.
ask If TRUE, ask the user before drawing the next plot; if FALSE don't ask.
... avPlots passes these arguments to avPlot. avPlot passes them to plot.
id.method,labels,id.n,id.cex,id.col Arguments for the labelling of points. The default is id.n=0 for labeling no points. See showLabels for details of these arguments.
col color for points; the default is the second entry in the current color palette (see palette and par).
col.lines color for the fitted line.
pch plotting character for points; default is 1 (a circle, see par).
lwd line width; default is 2 (see par).
xlab x-axis label. If omitted a label will be constructed.
ylab y-axis label. If omitted a label will be constructed.
type if "Wang" use the method of Wang (1985); if "Weisberg" use the method in the Arc software associated with Cook and Weisberg (1999)
grid If TRUE, the default, a light-gray background grid is put on the graph

Details

The function intended for direct use is avPlots (for which avp is an abbreviation).

Value

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

Author(s)

John Fox jfox@mcmaster.ca, Sanford Weisberg sandy@umn.edu

References

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

Fox, J. (2008) Applied Regression Analysis and Generalized Linear Models, Second Edition. Sage.

Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage.

Wang, P C. (1985) Adding a variable in generalized linear models. Technometrics 27, 273–276.

Weisberg, S. (2005) Applied Linear Regression, Third Edition, Wiley.

See Also

residualPlots, crPlots, ceresPlots,

Examples

avPlots(lm(prestige~income+education+type, data=Duncan))

avPlots(glm(partic != "not.work" ~ hincome + children, 
  data=Womenlf, family=binomial))

[Package car version 2.0-9 Index]