[Rd] Enhancement to termplot()
John Maindonald
john.maindonald at anu.edu.au
Sat Jan 24 03:23:47 MET 2004
I'd like to make the following change to termplot():
Add panel=points as an extra parameter.
Replace
if (partial.resid)
points(xx, pres[, i], cex = cex, pch = pch, col = col.res,
...)
by
if (partial.resid)
panel(xx, pres[, i], cex = cex, pch = pch, col = col.res,
...)
Also, I think, add col.smooth, span and iter as named parameters; see
below.
This allows, e.g., the following
par(mfcol=c(2, 2))
data(mtcars)
cars.lm <- lm(mpg~disp+hp, data=mtcars)
termplot(cars.lm, partial.resid=T, panel=panel.smooth,
col.smooth="blue")
termplot(cars.lm, partial.resid=T, panel=panel.smooth, col.terms=0,
col.smooth="blue")
(col.terms=0 hides the fitted response line or curve.)
These partial regression plots can be highly insightful in a regression
context.
Inclusion of col.smooth, span and iter as named parameters is not
strictly necessary, but it does avert complaints from plot() when they
are passed as unnamed parameters.
(I foreshadowed this when I submitted problem #6327, and offered a fix
that, in default of anything better, I assume will be made or has been
made.)
John Maindonald email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473 fax : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
More information about the R-devel
mailing list