在原始数据上绘制拟合的ARIMA结果时,拟合值有时会出现一个步骤:
library(forecast)
set.seed(1)
#simualted ts
eg <- arima.sim(n = 100, list(order = c(1,1,2), ar = -0.5, ma = c(.1, -0.3)),
sd = 1)
#fitted Arima with same order
eg_aa <- forecast::Arima(eg, order = c(1,1,2))
par(mfrow = c(2,1),
oma = c(0,0,0,0),
mar = c(2,4,1,1))
plot(eg, main="as-is") # plot original sim
lines(fitted(eg_aa), col = "red") # plot fitted values
legend("topleft", legend = c("original","fitted"), col = c("black","red"),lty = 1)
plot(eg, main = "time-deltat") # plot original sim
points(time(fitted(eg_aa))-deltat(eg), # plot fitted values shifted back one time-step
fitted(eg_aa),
type = "l", col = "red")
但并非总是如此,此示例中的拟合值排成一行:in-r-plot-arima-fitted-model-with-the-original-series
从我记得的时间序列中,一次性差异模型应该只适用于第一次之后的观察,所以我不清楚arima()在哪里得到t = 1。但最重要的是我想知道,如果明显的时移是一个错误或只是arima模型的奇怪结果。 有什么想法吗?