AddedVariable Plots
Description
These functions construct addedvariable (also called partialregression) plots for linear and generalized linear models.
Usage
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  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], id.location="lr",
col = palette()[1], col.lines = palette()[2],
xlab, ylab, pch = 1, lwd = 2,
main=paste("AddedVariable Plot:", variable),
grid=TRUE,
ellipse=FALSE, ellipse.args=NULL,
marginal.scale=FALSE, ...)
## 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], id.location="lr",
col = palette()[1], col.lines = palette()[2],
xlab, ylab, pch = 1, lwd = 2, type=c("Wang", "Weisberg"),
main=paste("AddedVariable Plot:", variable), grid=TRUE,
ellipse=FALSE, ellipse.args=NULL, ...)

Arguments
model 
model object produced by 
terms 
A onesided formula that specifies a subset of the predictors.
One addedvariable plot is drawn for each term. For example, the
specification 
intercept 
Include the intercept in the plots; default is 
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 
main 
The title of the plot; if missing, one will be supplied. 
ask 
If 
... 

id.method,labels,id.n,id.cex,id.col,id.location 
Arguments for the labelling of
points. The default is 
col 
color for points; the default is the second entry
in the current color palette (see 
col.lines 
color for the fitted line. 
pch 
plotting character for points; default is 
lwd 
line width; default is 
xlab 
xaxis label. If omitted a label will be constructed. 
ylab 
yaxis label. If omitted a label will be constructed. 
type 
if 
grid 
If 
ellipse 
If 
ellipse.args 
Arguments to pass to the 
marginal.scale 
Consider an addedvariable plot of Y versus X given Z. If this argument is 
Details
The function intended for direct use is avPlots
(for which avp
is an abbreviation).
Value
These functions are used for their side effect id producing plots, but also invisibly return the coordinates of the plotted points.
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. (2014) Applied Linear Regression, Fourth Edition, Wiley.
See Also
residualPlots
, crPlots
, ceresPlots
, link{dataEllipse}
Examples
1 2 3 4 5 6 7 8 9 10 11 12  avPlots(lm(prestige~income+education+type, data=Duncan))
avPlots(glm(partic != "not.work" ~ hincome + children,
data=Womenlf, family=binomial))
m1 < lm(partic ~ tfr + menwage + womwage + debt + parttime, Bfox)
par(mfrow=c(1,3))
plot(partic ~ womwage, Bfox) # marginal plot, ignoring other predictors
abline(lm(partic ~ womwage, Bfox), col="red", lwd=2)
grid()
avPlots(m1, ~ womwage) # av Plot, adjusting for others
avPlots(m1, ~ womwage, marginal.scale=TRUE) # av Plot, adjusting and scaling as in marginal plot
