[R] possible problem with plot.lm
Benilton Carvalho
bcarvalh at jhsph.edu
Thu Aug 20 16:53:29 CEST 2009
Hi,
Here's one toy example that shows what I believe to be a problem with
plot.lm. This was brought up by another user (Marcos Tadeu Andrade
Cordeiro). I took a look at the source and the problem appears to be
related to the fact that you need to reorder the data by the group
means and the correct order of the labels is lost.
set.seed(2)
a <- rnorm(50,0,2)
x <- rep(seq(10, 50, by=10), each=10)
y <- x+a
f <- rep(c("e","a","c","b","d"), rep(10,5))
f <- as.factor(f)
y[1] <- 200
mod1 <- aov(y ~ f)
par(mfrow=c(2,2))
plot(mod1)
The last plot suggests that the outliers belongs to group D, when in
fact it belongs to E.
Does this make any sense or are we missing something? I'm reporting
this with R-rc, but it is reproducible with previous versions too.
Thanks a lot,
b
--
> sessionInfo()
R version 2.9.2 RC (2009-08-17 r49309)
i386-apple-darwin9.8.0
locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
More information about the R-help
mailing list