I would like to use R “optimize” function to estimate the model:

$\hat{Y_{t}}=a\cdot \hat{Y}_{t-1}+b\cdot X_{t}+c\cdot X_{t-1}$

Important thing is that the predition $\hat{Y_{t}}$ (let’s say prediction of Y on Tuesday) is calculated on the basis of former prediction $\hat{Y}_{t-1}$ (not real value of $Y_{t-1}$) in time t-1 (Monday).

What is key word to google to find out more on this class of models? I mean time series models where prediction is based on former prediction, not actual value like in ARIMA models.

With an objective function I would like to minimize the sum of the squares of the errors between ${Y_{t}}$ and $\hat{Y}_{t}$. The objective function in one equation would look like endless spaghetti.

How to write objective function in R?

  • $\begingroup$ This sounds like an ARIMA model. $\endgroup$ – Zach Mar 1 '12 at 13:44
  • $\begingroup$ Maybe it sounds like ARIMA, but it ain't. ARIMA is easier to estimate because the forecast refers to previous real Y which is fixed. In my problem you refer to previous forecasted Y which changes anytime the parameters of the model change. $\endgroup$ – Przemyslaw Remin Mar 2 '12 at 10:20
  • $\begingroup$ Your link does not work. Please provide the referred material in a form that enables users to see it if it is important for understanding your problem - i.e. perfectly data and the code in the body of your question. $\endgroup$ – Tim Mar 15 '15 at 20:15

you can easily estimate this model using R function which is optim() or using simple lm() function in iterative manner, first you suppress Y(t-1) by setting a=0 then estimate b and c, this is first iteration, the next step is to add Y(t-1) as independent variable and estimate Y(t) once again, and again put Y(t) as Y(t-1); notice that by Y(t) I meant fitted variable in vector notation


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.