>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,

Just using data=train[-i,] ought to work.  I don't know how efficient
it is.

In article <[EMAIL PROTECTED]>,
David Winsemius  <[EMAIL PROTECTED]> wrote:

>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")

I've encountered suggestions to use bootstrap in circumstances such as
this before, but I've never understood them.  The bootstrap samples
will clearly violate the assumption of independent residuals that
underlies the usual regression model.  The bootstrap samples will also
have less diverse values for the predictor variables.  So it seems to
me that the bootstrap results will NOT be a good guide to what is
going on with the actual sample.

The poster's use of leave-one-out cross validation seems more sensible to me.

----------------------------------------------------------------------------
Radford M. Neal                                       [EMAIL PROTECTED]
Dept. of Statistics and Dept. of Computer Science [EMAIL PROTECTED]
University of Toronto                     http://www.cs.utoronto.ca/~radford
----------------------------------------------------------------------------
.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
.                  http://jse.stat.ncsu.edu/                    .
=================================================================

Reply via email to