Cornilia wrote in news:[EMAIL PROTECTED]: > I have a training data set, and I want to obtain the LOOCV error rate > for a linear regression model. How can I implement this in R or > S-Plus? I can use for loop and fit linear models n times, with one row > out each time. My main problem is that I don't know how to leave one > row out of my data set in lm function within the for loop. > > It might look like: > for (i in 1:n) { > fitcv<-lm(y ~ V1+V2+V3+V4+V5+V6+V7+V8+V9,data=train, > subset([anything but the row i])) > <then get the sum of errors> > } > > Is there a way or anything better to do this? Any suggestions would be > appreciated. > Not sure what your acronym means, but it sounds as though you are doing a jack-knife analysis. Why not do a real bootstrap analysis? If you are already using R, it should not be difficult to find the boot package. I think it is in the default 1.8.1 distribution. You would bring it into the workspace with library("boot")
An example is described here: http://maths.newcastle.edu.au/~rking/R/help/02b/4109.html The R-help mailing list can be accessed at: http://maths.newcastle.edu.au/~rking/R/ -- David Winsemius . . ================================================================= Instructions for joining and leaving this list, remarks about the problem of INAPPROPRIATE MESSAGES, and archives are available at: . http://jse.stat.ncsu.edu/ . =================================================================
