On Thu, 22 Jan 2004, Simon Wotherspoon wrote:
> Hi,
> Is this a bug in termplot, or (once again) do I just not
> understand what R is really doing?
Yes, it's a bug. The lower right plot has the partial residuals for x1
not for x2. The fitted line is correct.
-thomas
>
> I am using termplot to contruct partial residual plots,
> 1. For all terms at once
> 2. One term at a time
> but I get different results from these two methods. To give a concrete
> example, I would have thought the top and bottom rows of the plot
> constructed with the following code would be identical.
>
> Grateful for any clues
>
> Simon.
>
>
>
> ## Term plot example
>
> n <- 50
> x1 <- 2*runif(n)
> x2 <- 2*runif(n)
> y <- x1+sin(x2)+0.1*rnorm(n)
>
> fit <- lm(y ~ x1 +x2)
> par(mfrow=c(2,2))
> termplot(fit,partial=T)
> termplot(fit,terms="x1",partial=T)
> termplot(fit,terms="x2",partial=T)
>
>
>
> --please do not edit the information below--
>
> Version:
> platform = i386-pc-mingw32
> arch = i386
> os = mingw32
> system = i386, mingw32
> status > major = 1
> minor = 8.1
> year = 2003
> month = 11
> day = 21
> language = R
>
> Windows ME 4.90 (build 3000)
>
> Search Path:
> .GlobalEnv, package:methods, package:ctest, package:mva, package:modreg,
> package:nls, package:ts, Autoloads, package:base
> ---
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle