甲乙小朋友的房子

甲乙小朋友很笨,但甲乙小朋友不会放弃

0%

AR模型选择&bound

这篇乱七八糟。想删了。

AR模型选择

Python 的AR.fit()方法有一个参数叫做“ic",是用来给AR选择lag的标准。它有4个选项:

  • "AIC" 选择一个lag,使得Akaike Information Criterion最小化. AIC=-2lnL+2k
  • "BIC" 最小化Bayes Information Criterion. BIC=-2lnL+2lnN*k
  • "HIC" :最小化Hannan-Quinn Information Criterion.
  • "t-stat" 从maxlag开始,丢掉一些lag,直到结果的t-stat 达到显著水平95%。HIC=-2*L+2kln(ln(n))

where

  • L is the value of the likelihood. The larger L, the better fit.
  • N is the number of recorded measurements
  • k is the number of estimated parameters. The larger k, the more complex model is.

So AIC and BIC and HIC are measures that can trade-off between model fit and complexity of model.

statmodels.ar_model()的代码 说AR代码是使用 Lutkephol's definition的定义来完成的:

\[aic=log \sigma_p^2+2k\]

Where:

  • $ _p^2=$ 是is AR(p) 模型的均方误差 , 而残差resid是模型的训练误差,n是样本个数,p是当前的AR的lag.
  • k是模型的参数个数,在AR里就是p或者p+1

预测bound

 《Time Series Analysis With Applications in R》said

因此我们可以定义bound = Y_preds ± 1.96*sqrt(σ)

正如参考文献the reference 所述,对于多步预测来说,一般预测误差都是随着h的增大而增大。因此我们还可以定义σ = σ*sqrt(h) ,这样更加合理。

需要注意的是,在这里的误差最好使用验证集的误差,这样更合理一些。