statsmodel AR模型回答错误

2024-10-01 17:36:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试在Python中复制以下R代码

set.seed(1)
x<-w<-rnorm(100)
for (t in 2:100) x[t] = 0.6 * x[t-1] + w[t]
x.ar = ar(x, method="mle")
x.ar$ar
[1] 0.5231187

在python中,我有以下代码。在

^{pr2}$

在python中,它似乎符合order13模型。我怎样才能使它适合最简单的型号?在


Tags: 代码in模型formethodseedar型号
1条回答
网友
1楼 · 发布于 2024-10-01 17:36:30

请参见docs:对于statsmodels.tsa.ar_model.AR.fit(),您可以选择一个信息条件(参数ic)来确定滞后的数量:

Criterion used for selecting the optimal lag length. aic - Akaike Information Criterion bic - Bayes Information Criterion t-stat - Based on last lag hqic - Hannan-Quinn Information Criterion If any of the information criteria are selected, the lag length which results in the lowest value is selected. If t-stat, the model starts with maxlag and drops a lag until the highest lag has a t-stat that is significant at the 95 % level.

或提供maxlag值。如果缺少后者,statsmodels使用默认的round(12*(nobs/100.)**(1/4.))来确定要使用的lag数。在

相关问题 更多 >

    热门问题