很明显,既有线性趋势,也有季节性趋势。我可以通过采用第一个和第十二个(季节性)差异来解决这两个问题:diff(diff(data), 12)。这样做之后,这里是结果数据的图
这个数据看起来不太好。虽然平均值保持不变,但随着时间的推移,我们看到了漏斗效应。以下是 ACF/PACF :
任何可能适合尝试的建议。我使用了建议 ARIMA(2,0,2)xARIMA(1,0,2)(12) 模型的 auto.arima() 函数。然而,一旦我从拟合中取出残差,很明显它们中仍然存在某种结构。这是拟合的残差图以及残差的 ACF/PACF。
关于哪些滞后在残差的 ACF/PACF 中出现峰值,似乎没有季节性模式。但是,这仍然是前面步骤未捕获的内容。你建议我怎么做?我怎样才能构建一个具有更好模型诊断的更好模型(此时它只是一个更好看的 ACF 和 PACF)?
到目前为止,这是我的简化代码:
library(TSA)
library(forecast)
beer <- read.csv('beer.csv', header = TRUE)
beer <- ts(beer$Production, start = c(1956, 1), frequency = 12)
# transform data
boxcox <- BoxCox.ar(beer) # 0 in confidence interval
beer.log <- log(beer)
firstDifference <- diff(diff(beer.log), 12) # get rid of linear and
# seasonal trend
acf(firstDifference)
pacf(firstDifference)
eacf(firstDifference)
plot(armasubsets(firstDifference, nar=12, nma=12))
# fitting the model
auto.arima(firstDifference, ic = 'bic') # from forecasting package
modelFit <- arima(firstDifference, order=c(1,0,0),seasonal
=list(order=c(2, 0, 0), period = 12))
# assessing model
resid <- modelFit$residuals
acf(resid, lag.max = 15)
pacf(resid, lag.max = 15)
这是数据,如果有兴趣(我认为如果您愿意,可以使用 html 到 csv 转换器):https ://docs.google.com/spreadsheets/d/1S8BbNBdQFpQAiCA4J18bf7PITb8kfThorMENW-FRvW4/pubhtml