From bcarvalh at jhsph.edu  Fri Aug 21 23:00:33 2009
From: bcarvalh at jhsph.edu (Benilton Carvalho)
Date: Fri, 21 Aug 2009 18:00:33 -0300
Subject: [Rd] problem with plot.lm?
Message-ID: <B9FAFC26-C444-445A-8EC6-9AC81F1E5989@jhsph.edu>

I'm bringing this issue to r-devel as my idea of sending it to r-help  
appears to be wrong.

The following is reproducible in R-patched and R-devel (also in older  
versions).

An outlier is inserted in group E and the last plot by plot.lm  
suggests that the point belongs to D.

It appears to me that:

* (facval, rsp) and
* x$xlevels[[1L]][order(sapply(split(yh,mf[,1]), mean))]

are sorted differently.

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)


My latest attempt was on:

 > sessionInfo()
R version 2.10.0 Under development (unstable) (2009-08-20 r49335)
x86_64-unknown-linux-gnu

locale:
  [1] LC_CTYPE=en_US.iso885915       LC_NUMERIC=C
  [3] LC_TIME=en_US.iso885915        LC_COLLATE=en_US.iso885915
  [5] LC_MONETARY=C                  LC_MESSAGES=en_US.iso885915
  [7] LC_PAPER=en_US.iso885915       LC_NAME=C
  [9] LC_ADDRESS=C                   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
 >



thank you,
b



[Rd] problem with plot.lm?
Benilton Carvalho