[R] Repeated cross-validation for a lm object
Greg Snow
538280 at gmail.com
Sat Feb 18 20:15:46 CET 2012
The validate function in the rms package can do cross validation of
ols objects (ols is similar to lm, but with additional information),
the default is to do bootstrap validation, but you can specify
crossvalidation instead.
On Thu, Feb 16, 2012 at 10:44 AM, samuel-rosa
<alessandrosamuel at yahoo.com.br> wrote:
> Dear R users
>
> I'd like to hear from someone if there is a function to do a repeated k-fold
> cross-validation for a lm object and get the predicted values for every
> observation. The situation is as follows:
> I had a data set composed by 174 observations from which I sampled randomly
> a subset composed by 150 observations. With the subset (n = 150) I fitted
> the model: y = a + bx. The model validation has to be done using a repeated
> k-fold cross-validation on the complete data set (n = 174). I need to use 10
> folds and repeat the cross-validation 100 times. In the end of the
> procedure, I need to have access to the predicted values for each
> observation, that is, to the 100 predicted values for each observation. The
> function lmCV() in the package chemometrics provides the predicted values.
> However, it works only with multiple linear regression models.
> I hope there is a way of doing it.
> Best regards,
>
> -----
> Bc.Sc.Agri. Alessandro Samuel-Rosa
> Postgraduate Program in Soil Science
> Federal University of Santa Maria
> Av. Roraima, nº 1000, Bairro Camobi, CEP 97105-970
> Santa Maria, Rio Grande do Sul, Brazil
> --
> View this message in context: http://r.789695.n4.nabble.com/Repeated-cross-validation-for-a-lm-object-tp4394833p4394833.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com
More information about the R-help
mailing list