为什么 `arima()` 和 `Arima()` 给出不同的 AIC 和 sigma2,同时给出相同的系数和相同的可能性?

机器算法验证 r 时间序列 有马
2022-03-13 12:26:51

当我试图在 R 中找到 ARIMA 模型的最佳参数时,这个问题发生了好几次。下面是一个例子:

我的数据是:

22 41 34 29 27 41 37 17 40 38 31 25 27 30 36 42 26 31 28 20 36 37 39 29 53 59 43 36 33 43 33 17 43 42 52 44 45 51 66 45 38 41 37 37 52 55 43 40 61 45 71 57 66 85 85 37 51 58 50 56 47 63 89 57 54 76 73 51 82 119 108 86

我读取我的数据并将其转换为 ts 对象:

data <- read.table('test_data.txt')
data <- as.data.frame(t(data))
ts.test <- ts(data, start = c(2014, 1), frequency = 12)

我尝试使用auto.arima()外生变量找到最佳参数tt

tt <- seq(length(ts.test))
auto.arima(ts.test, xreg = tt)

结果如下:

## Series: ts.test 
## Regression with ARIMA(0,0,1)(2,0,0)[12] errors 
## 
## Coefficients:
##          ma1    sar1    sar2  intercept    xreg
##       0.5386  0.2667  0.2558    21.7004  0.7458
## s.e.  0.0951  0.1298  0.1515     5.3415  0.1128
## 
## sigma^2 estimated as 132.9:  log likelihood=-277.4
## AIC=566.79   AICc=568.09   BIC=580.45

当我尝试Arima()

Arima(ts.test, xreg = tt, order = c(0, 0, 1),
      seasonal = list(order = c(2, 0, 0), period = 12))

auto.arima()它在以下方面给出了相同的结果σ2和 AIC 以及可能性:

## Series: ts.test 
## Regression with ARIMA(0,0,1)(2,0,0)[12] errors 

## Coefficients:
##          ma1    sar1    sar2  intercept    xreg
##       0.5386  0.2667  0.2558    21.7004  0.7458
## s.e.  0.0951  0.1298  0.1515     5.3415  0.1128
## 
## sigma^2 estimated as 132.9:  log likelihood=-277.4
## AIC=566.79   AICc=568.09   BIC=580.45

但是当我尝试适应它时arima()

arima(ts.test, xreg = tt, order = c(0, 0, 1),
      seasonal = list(order = c(2, 0, 0), period = 12))

它给了我:

## Call:
## arima(x = ts.test, order = c(0, 0, 1), seasonal = list(order = c(2, 0, 0), period = 12), xreg = tt)
## 
## Coefficients:
##          ma1    sar1    sar2  intercept    xreg
##       0.5386  0.2667  0.2558    21.7004  0.7458
## s.e.  0.0951  0.1298  0.1515     5.3415  0.1128
## 
## sigma^2 estimated as 123.6:  log likelihood = -277.4,  aic = 564.79

请注意,这 3 个函数给出了相同的参数及其标准误差,但arima()给出的参数不同σ2和不同的 AIC(总是比其他 AIC 增加 2),而可能性保持不变。

任何人都可以给出解释吗?非常感谢!

1个回答

stats::arima()估计σ2使用创新方差的 MLE,同时forecast::Arima()使用无偏估计ei2/(nk)在哪里n是可用的观察数和k是估计的参数数量。

stats::arima()不算数σ2作为 AIC 计算中的参数,而将其计算forecast::Arima()在内。Burnham 和 Anderson (Springer, 2002)建议包括σ2按照Arima()