[R] Repeated cross-validation for a lm object

samuel-rosa alessandrosamuel at yahoo.com.br
Thu Feb 16 18:44:57 CET 2012


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.



More information about the R-help mailing list