Dear all,
I'm fitting a linear model with numerous lag terms of the response variable [i.e. y(t-1), y(t-2),y(t-3)...,] and other explanatory variables [x(1), x(2), x(3),....]- which go into my design matrix X. I'm fitting the linear model: lm(Y ~ X, ...). I would like to use the predict.lm function however the future predictions of Y are dependent upon previous predictions of Y [i.e. the response lag terms]. Does anyone know how I would go about using predict.lm to make future forecasts of Y? Or, does this have to be writting as a for loop that recursively updates the lag terms for each future prediction of y(i)? The data is a time series and the model is only calculated once in order to make the future predictions. Thanks, Dave [[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.