[R] step-wise and prediction

Spencer Graves spencer.graves at pdf.com
Tue Jul 1 16:22:22 CEST 2003


Have you considered "predict(regrM)"?

J'espere que ces mots vous aideront.
Spencer Graves

ATHANASIA KAMARIOTIS wrote:
> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list