# Calculate ARIMA fitted value by hand

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


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?

• 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?
– whuber
Commented Dec 24, 2018 at 16:11
• 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.
– Zack
Commented Dec 26, 2018 at 2:39
• You seem to mistake the orders of the ARIMA model with the coefficients! Those are totally different things.
– whuber
Commented Dec 26, 2018 at 16:16
• Where is the mistake? Could you mind telling me the correct formula?
– Zack
Commented Dec 28, 2018 at 15:50
• Explore the hits at stats.stackexchange.com/search?q=arima+formula+score%3A1 for many actual examples.
– whuber
Commented Dec 28, 2018 at 15:52