[R] step-wise and prediction

ATHANASIA KAMARIOTIS athanasia.kamariotis at epfl.ch
Tue Jul 1 15:36:02 CEST 2003


I would like to know how to use the function step with "for" in order 
to predict.
Id est:

Let M , A, B ,C be vectors of length 15

for(i in 1:5)
{

regrM<-lm(M[(1+i):(10+i)]~A[(1+i):(10+i)]+B[(1+i):(10+i)]+C[(1+i):
(10+i)])

sregrM<-step(regrM)

and then I would like to compute the predicted value : M* of M, using 
the predictors selected by the function step.
For example if i=1 and step gives us the model M~A,
then in the "for", I want to compute M* by the means of A[11], and 
compare this value to the real value M[11] and so on.



Merci d'avance ,
Cordialement 
Athanasia




More information about the R-help mailing list