I want to compare these two linear models by anova:
a<-c(-10:-1 , 1:10)
b<-sample(1000, 20, replace = FALSE)
ID<-rep(c("no","bo"), each=10)
dataf<-data.frame(a, b, ID)
x<-lm(dataf[1:10,]$a~dataf[1:10,]$b)
y<-lm(dataf[11:20,]$a~dataf[11:20,]$b)
anova(x,y)
Unfortunately when I run the test I got this warning where it says:
Warning message:In anova.lmlist(object, ...) :
models with response ‘"dataf[11:20, ]$a"’ removed because response differs from model 1
May be the I should use another test. Can somebody help me to better understand and solve this?