I use: fit = auto.arima(Y, xreg=X)
in R to get ARIMA(1,0,0), result as follows:
ar1: 0.3793; intercept: 9132.46; X: 22.0469
Then:
- I build the function:
(Y(t) - 9132.46) = 0.3793*(Y(t-1) - 9132.46) + 22.0469*X(t)
in Excel to calculate fitted value and predicted value manually. - In R, I use
fitted(fit)
to get fitted value,forecast()
to get predicted value.
But I found the results of 1) and 2) are different, is there anything wrong with the function I built?