Re: [R] anova.lm and F-test

2012-07-09 Thread SKrishna
Dear Peter, Thank you very much for that excellent answer to a rather stupid question :) I did not notice that the RSS actually increased for the model with more parameters and so in this case the F-statistic is negative and therefore a p-value from the F-distribution is meaningless. But I guess y

Re: [R] anova.lm and F-test

2012-07-09 Thread peter dalgaard
On Jul 9, 2012, at 15:40 , Suresh Krishna wrote: > > Hello, > > Why does anova.lm sometimes return a p-value and at other times not ? Is it > because it recognizes nested models from non-nested ones ? > >> x<-seq(1,100,1) >> y<-3*x+rnorm(100) >> anova(lm(y~x),lm(y~x+I(x^2)),test="F") > Analy

[R] anova.lm and F-test

2012-07-09 Thread Suresh Krishna
Hello, Why does anova.lm sometimes return a p-value and at other times not ? Is it because it recognizes nested models from non-nested ones ? x<-seq(1,100,1) y<-3*x+rnorm(100) anova(lm(y~x),lm(y~x+I(x^2)),test="F") Analysis of Variance Table Model 1: y ~ x Model 2: y ~ x + I(x^2) Res.D