Hi Felipe, Make sure "predictors" data.frame has the EXACT same column names as the data.frame you used for creating ModeloLineal.
Cheers, Tal ----------------Contact Details:------------------------------------------------------- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Tue, Apr 6, 2010 at 2:14 AM, Luis Felipe Parra < felipe.pa...@quantil.com.co> wrote: > Hello I am trying to use predict.lm, but I am having trouble getting out of > sample predictions. I am getting the same output if I use the following > three commands: > > predict(ModeloLineal,predictors[721:768,]) > predict(ModeloLineal,predictors[1:768,]) > predict(ModeloLineal) > > where ModeloLineal is the output from ModeloLineal<-lm(dataTS[,6] ~ > predictors[1:720,]), so the first 720 observations of predictors i would > like to use them to build my model and the other 48 I would like to use > them > to have an out of sample forecast, Do you know how can I do this? > > Thank you > > Felipe Parra > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.