[R] Odd anova(lm()) order phenomenon, looking for an explanation
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Fri Mar 31 12:09:14 CEST 2006
Berwin A Turlach <berwin at maths.uwa.edu.au> writes:
> Don't know if the following example, which shows the same behaviour,
> leads to any insight.
>
> > n <- 100
> > x1 <- runif(n, -1,1)
> > x2 <- runif(n, -1,1)
> > y <- x1*x1*x2 + rnorm(n, sd=0.05)
> > y <- y - mean(y)
> > anova(lm(y~x1+x2))
Here's another (paraphrased from the Pixel data in nlme, which have
similar behaviour)
x1 <- runif(100,8,10)
x2 <- x1^2
y <- (x1 - 9)^2 + rnorm(100, sd=.1)
plot(x1, y)
anova(lm(y ~ x1 + x2))
anova(lm(y ~ x2 + x1))
summary(lm(y ~ x1))
summary(lm(y ~ x2))
summary(lm(y ~ x1 + x2))
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list