[R] forecast.lm() and NEWDATA

Ryan ryan at urban-econ.com
Fri Nov 1 14:50:12 CET 2013


Good day all.

I am hoping you can help me (and I did this right). I've been working in 
R for a week now, and have encountered a problem with forecast.lm().

I have a list of 12 variables, all type = double, with 15 data entries.
(I imported them from tab delimited text files, and then formatted 
as.numeric to change from list to double)
(I understand that this leaves me rather limited in my degrees of 
freedom, but working with what I have, sadly. )

I have a LM model, such that
REGGY = lm(formula=Y~A,B,C,...,I,J)
which I am happy with.

I have
NEWDATA = data.frame(A+B+C+D....+I+J)

When i try to run

forecast.lm(REGGY, h=5)

i receive the following error
"Error in as.data.frame(newdata) :
   argument "newdata" is missing, with no default"

When I run
forecast.lm(REGGY, NEWDATA, h=5)
I receive the confidence intervals of the 15 data entries I already 
possess. I understand that by including NEWDATA, the "h=5" is ignored, 
but without NEWDATA, I receive the error message.

Can anyone help me please?

Regards
Ryan

P.S The forecast is trying to predict the next 5 values for Y from the 
regression model pasted above. I'm a bit rusty with regressions, but I 
think I've covered my bases as well as I can, and from what I understand 
of the R code, I'm following the right steps.



More information about the R-help mailing list