fit <- forecast::Arima(lr.error, 
         order=c(0, 2, 1))
print(paste('The Predicted Value is', 
print(paste('The Equation value is', 
     2*fit$x[34] - fit$x[33] - 1*fit$residuals[34])) 

enter image description here

I think the ARIMA equation is correct, but I don't know why the value I calculated by hand differs from the one given by R. Where does the difference come from?

  • $\begingroup$ Unless I misunderstand your initial code, you don't seem to have employed the coefficients estimated by the model. Why, then, do you expect to be able to reproduce the model's fit? $\endgroup$
    – whuber
    Commented Dec 24, 2018 at 16:11
  • $\begingroup$ I used the ma1 coefficient (-1.0000). The equation is Y(t) = 2*Y(t-1) - 1*Y(t-2) - 1*Residual(t-1). The coefficient of residual(t-1) is the ma1 coefficient (-1.0000). My task is to obtain the equation, so i reproduce the model's fit to test whether my equation is correct or nor. $\endgroup$
    – Zack
    Commented Dec 26, 2018 at 2:39
  • $\begingroup$ You seem to mistake the orders of the ARIMA model with the coefficients! Those are totally different things. $\endgroup$
    – whuber
    Commented Dec 26, 2018 at 16:16
  • $\begingroup$ Where is the mistake? Could you mind telling me the correct formula? $\endgroup$
    – Zack
    Commented Dec 28, 2018 at 15:50
  • 1
    $\begingroup$ Explore the hits at stats.stackexchange.com/search?q=arima+formula+score%3A1 for many actual examples. $\endgroup$
    – whuber
    Commented Dec 28, 2018 at 15:52

1 Answer 1


You can calculate the fitted values by hand by remember there is one (or more?) differences in your ARIMA( the parameter in the middle is differences) so you would need to reproduce the differences and after that you will be able to have it


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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