简体   繁体   English

AIC,AR中具有受限系数的ARIMA的BIC值

[英]AIC, BIC values of ARIMA with restricted coefficients in R

Different ways of specifying the same AR (or MA) model to be estimated by function arima() in package forecast in R yield different BIC (Bayesian information criterion) values. 指定由R中的包forecast中的函数arima()估计的相同AR(或MA)模型的不同方式产生不同的BIC(贝叶斯信息准则)值。

Why does this happen? 为什么会这样?

Consider two models: 考虑两种模式:

(1) AR(1) (1)AR(1)
(2) AR(2) with coefficient on AR2 restricted to zero (2)AR(2),AR2上的系数限制为零

On paper, the two model are the same. 在纸面上,两个模型是相同的。 However, their estimation might differ (?). 但是,他们的估计可能会有所不同(?)。 Not sure why they produce equal coefficient estimates, equal log-likelihood values and equal AIC values -- but different BIC values. 不确定为什么他们产生相等的系数估计,相等的对数似然值和相等的AIC值 - 但不同的BIC值。

Since BIC values differ while likelihoods are equal and AIC values are equal, the number of observations used in estimation must be different between the two models. 由于BIC值不同而可能性相等且AIC值相等,因此估计中使用的观察数量必须在两个模型之间不同。 However, the implied difference in the number of observations is not 1 or 2 but much more. 然而,观察数量的隐含差异不是1或2,而是更多。

Is this justified, or is it a bug ??? 这是正当的,还是一个错误?

I wonder what the difference is and how BIC is calculated in case (2). 我想知道差异是什么以及在案例(2)中如何计算BIC。 I would like to be able to reproduce the results, so I need to understand how things work here. 我希望能够重现结果,所以我需要了解这里的工作原理。

Below I provide a reproducible example. 下面我提供了一个可重复的例子。 Having executed it in R, look at the printed BIC, and also AICc, values -- they are different between the models. 在R中执行它,看看打印的BIC,以及AICc,值 - 它们在模型之间是不同的。

library(forecast)
T=1000; seed=1; set.seed(seed); x=rnorm(T) 
model1=arima(x,order=c(1,0,0)                 ,method="CSS-ML",transform.pars=FALSE)
model2=arima(x,order=c(2,0,0),fixed=c(NA,0,NA),method="CSS-ML",transform.pars=FALSE)
print(model1)
print(model2)

The same applies to AR(p) and MA(q) models, which I do not discuss explicitly to keep it simple. 这同样适用于AR(p)和MA(q)模型,我没有明确讨论这些模型以保持简单。

Would be great if someone could explain why this happens. 如果有人可以解释为什么会发生这种情况会很棒。 Thanks! 谢谢!

The calculation of AICc and BIC is done within the forecast:::print.Arima function, while AIC is returned by arima() . AICc和BIC的计算在forecast:::print.Arima函数内完成,而AIC由arima()返回。 If you look at the code for forecast:::print.Arima you will see the following: 如果你查看forecast:::print.Arima的代码,你会看到以下内容:

npar <- length(x$coef) + 1
nstar <- length(x$residuals) - x$arma[6] - x$arma[7] * x$arma[5]
bic <- x$aic + npar * (log(nstar) - 2)
aicc <- x$aic + 2 * npar * (nstar/(nstar - npar - 1) - 1)

Note that npar does not take account of non-estimated coefficients (ie, those restricted to specified values). 注意, npar没有考虑非估计系数(即那些限于指定值的系数)。 It assumes that all coefficients in x$coef have been estimated. 它假设已经估算了x$coef中的所有系数。 It would be possible to correct this by using 可以通过使用来纠正这个问题

npar <- length(x$coef[x$mask]) + 1

I've fixed the github version of the package , so the CRAN version will be updated at the next release. 我修复了github版本 ,因此CRAN版本将在下一个版本中更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM