Hi, everyone
When I was using cv.lm(DAAG) , I found there might be something wrong with
it. The problem is that we can't use it to deal with a linear model with
more than one predictor variable. But the usage documentation
hasn't informed us about this.
You can find it by excuting the following code:
xx=matrix(rnorm(20*3),ncol=3)
bb=c(1,2,0)
yy=xx%*%bb+rnorm(20,0,10)
data=data.frame(y=yy,x=xx)
myformula=formula("y ~ x.1 + x.2 + x.3")
cv.lm(data,myformula,m=10,plotit=F, printit=TRUE)
myformula=formula("y ~ x.1 + x.2")
cv.lm(data,myformula,m=10,plotit=F, printit=TRUE)
myformula=formula("y ~ x.1 ")
cv.lm(data,myformula,m=10,plotit=F, printit=TRUE)
What happened? they give three equal mss(mean squared error).
Or you can just check the code of function cv.lm(DAAG), then you will find
the residues are all derived from a model with only one predictor, but the
coefficient of that only one predictor can be calculated from a model with
more than one predictors which you've set in the formula term in
cv.lm(DAAG),
--
Junjie Li, klijunjie@gmail.com
Undergranduate in DEP of Tsinghua University,
[[alternative HTML version deleted]]