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@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.
Enhancement to termplot()
2 messages · John Maindonald, Thomas Lumley
On Sat, 24 Jan 2004, John Maindonald wrote:
I'd like to make the following change to termplot(): Add panel=points as an extra parameter.
(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.)
I added a smooth= option, and fixed the bug at that time (a search of bugs.r-project.org finds it in Models-fixed). The suggested fix didn't quite work, but a modification of it did. BTW, for people who don't know, you can usually find help pages for R-devel linked at the R web page, allowing you to check if things have been changed. At the moment it hasn't caught up with the reorganisation of the base packages. -thomas