ADF test in statsmodels in Python(在 Python 中的 statsmodels 中进行 ADF 测试)
问题描述
我正在尝试在 Python 中的 statsmodels 中运行增强的 Dickey-Fuller 测试,但我似乎遗漏了一些东西.
这是我正在尝试的代码:
将 numpy 导入为 np将 statsmodels.tsa.stattools 导入为 tsx = np.array([1,2,3,4,3,4,2,3])结果 = ts.adfuller(x)
我收到以下错误:
我的 Numpy 版本:1.6.1我的统计模型版本:0.4.1我正在使用窗户.
我正在查看文档 这里 但不知道我做错了什么.我错过了什么?
提前致谢.
解决方案 我想通了.默认情况下,maxlag
设置为 None
,而它应该设置为整数.像这样的工作:
输出:
<预><代码>>>>结果(-2.6825663173365015,0.077103947319183241,0,7,{'5%':-3.4775828571428571,'1%':-4.9386902332361515,'10%':-2.8438679591836733},15.971188911270618)
I am trying to run a Augmented Dickey-Fuller test in statsmodels
in Python, but I seem to be missing something.
This is the code that I am trying:
I get the following error:
My Numpy Version: 1.6.1 My statsmodels Version: 0.4.1 I am using windows.
I am looking at the documentation here but can't figure what I am doing wrong. What am I missing?
Thanks in Advance.
I figured it out. By default maxlag
is set to None
, while it should be set to integer. Something like this works:
Output:
这篇关于在 Python 中的 statsmodels 中进行 ADF 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!