模拟数据:
dput(test)
structure(list(xx = c(11.68, 11.29, 11.17, 10.41, 9.36, 9.52,
8.67, 7.69, 8.36, 6.97, 7.05, 7.08, 6.62, 6.35, 5.96, 4.91, 7.25,
8.66, 7.85, 9, 8.14, 6.99, 7.23, 6.16, 6.42, 6.6, 5.47, 4.85,
5.12, 4.76, 4.72, 5.32, 5.04, 5.32, 4.83, 4.83, 4.95, 5.28, 5.53,
6.01, 6.16, 6.08, 5.81, 5.3, 4.94, 5.24, 4.04, 3.79, 4.62, 3.96,
3.78, 3.55, 4.06, 3.17, 3.32, 3.26, 2.98, 3.74, 3.51, 3.26, 3.58,
3, 3.37, 3.83, 4.07, 4.5, 3.88, 3.95, 3.98, 4.66, 4.25, 3.94,
2.67, 3.35, 3.03, 1.32, 1.51, 1.89, 1.89, 1.88, 2.03, 1.75, 1.58,
1.9, 2.13, 1.86, 1.07, 0.99, 1.32, 1.04, 1.16, 1.2, 1.1, 1.35,
1.42, 1.2, 1.23, 1.2, 1.17, 1.06, 0.48, 0.59, 0.54, 0.5, 0.52,
0.55, 0.51, 0.87, 0.84, 1.12, 1.64), exogenous = c(1000812, 996428,
992312, 983312, 970940, 971216, 972260, 978320, 976604, 977624,
984456, 988460, 992740, 1002084, 1012104, 1016452, 1032688, 1050108,
1064876, 1070644, 1079808, 1079192, 1082396, 1086852, 1088284,
1094408, 1101852, 1112128, 1130888, 1142100, 1156644, 1167744,
1182440, 1185032, 1194124, 1212376, 1234436, 1246896, 1267536,
1288632, 1307456, 1323244, 1338256, 1344260, 1345544, 1347708,
1345300, 1353236, 1373616, 1380512, 1392532, 1401380, 1411232,
1408736, 1408912, 1422748, 1433548, 1449596, 1464716, 1474380,
1481728, 1491148, 1509664, 1528212, 1535496, 1536604, 1537388,
1546744, 1558392, 1573918, 1580083, 1581735, 1581352, 1587900,
1603940, 1583744, 1544576, 1527264, 1533664, 1549808, 1569424,
1576764, 1586548, 1601924, 1617568, 1622520, 1642276, 1650212,
1652392, 1657760, 1662560, 1664068, 1678948, 1688500, 1703332,
1721832, 1722728, 1739560, 1748676, 1758956, 1755852, 1750036,
1760456, 1760356, 1773768, 1765508, 1785276, 1799056, 1814848,
1840508, NA)), .Names = c("xx", "exogenous"), class = c("data.table",
"data.frame"), row.names = c(NA, -111L), .internal.selfref = <pointer: 0x0000000000090788>)
我有一个绝对不稳定的数据,这很好用:
auto.arima(ts(data = test$xx))
Series: ts(data = test$xx)
ARIMA(2,1,2) with drift
但是,当我使用外生变量并且该过程适合ARIMA-errors时,它不会区分:
auto.arima(ts(data = test$xx), xreg=test$exogenous, trace=TRUE)
Series: ts(data = test$xx)
Regression with ARIMA(1,0,0) errors
我打开trace并意识到它甚至没有考虑微分:
ARIMA(2,0,2) with non-zero mean : Inf
ARIMA(0,0,0) with non-zero mean : 341.2597324
ARIMA(1,0,0) with non-zero mean : 209.7431147
ARIMA(0,0,1) with non-zero mean : 259.8316269
ARIMA(0,0,0) with zero mean : 586.1168037
ARIMA(2,0,0) with non-zero mean : 211.9364634
ARIMA(1,0,1) with non-zero mean : 211.9364098
ARIMA(2,0,1) with non-zero mean : Inf
ARIMA(1,0,0) with zero mean : Inf
外生变量也是非平稳的。我错过了什么?对于ARIMA 错误,我们应该只提供固定数据吗?
基于Rob.Hyndman,他在评论中提到:
“这个问题已经解决了。无需手动进行任何差分。只需使用 xreg=xr ,一切都应该正常工作。”