

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,
	[[alternative HTML version deleted]]

