我开始重写我所有的代码,从预测到寓言。有人知道为什么常数与平均值不同吗?
library("fable")
library("lubridate")
library("dplyr")
library("forecast")
# gen data
set.seed(68)
df <- data.frame(time = ymd(Sys.Date() - c(1:1000)),
V = rnorm(1000, 0.2))
df <- fabletools::as_tsibble(df, index = time, regular = TRUE) %>% dplyr::arrange(time)
# fable model
df %>% fabletools::model(fable::ARIMA(V ~ pdq(3, 0, 0) + PDQ(0, 0, 0))) %>% report()
# forecast model
as.ts(df) %>% forecast::Arima(c(3, 0, 0), include.mean = TRUE)
寓言模型
Series: V
Model: ARIMA(3,0,0) w/ mean
Coefficients:
ar1 ar2 ar3 constant
-0.0578 -0.0335 -0.0158 0.2141
s.e. 0.0316 0.0317 0.0317 0.0308
sigma^2 estimated as 0.9499: log likelihood=-1391.23
AIC=2792.45 AICc=2792.51 BIC=2816.99
预测模型
Series: .
ARIMA(3,0,0) with non-zero mean
Coefficients:
ar1 ar2 ar3 mean
-0.0578 -0.0335 -0.0158 0.1934
s.e. 0.0316 0.0317 0.0317 0.0278
sigma^2 estimated as 0.9499: log likelihood=-1391.23
AIC=2792.45 AICc=2792.51 BIC=2816.99
并且我在错误后得到了一些高阶模型,我无法正确解释。我可以用 估计模型forecast
,即使模型可能很傻,我什至不能用 估计它们fable
Warning message:
1 error encountered for ar
[1] There are no ARIMA models to choose from after imposing the `order_constraint`, please consider allowing more models.`