我正在尝试在使用stats模型的情况下应用ADF测试,但遇到一种错误。
我已应用以下代码。
from statsmodels.tsa.stattools import adfuller
dataframe
A B C D
0 30.94 23.07 78.01 79.56
1 30.88 22.87 78.44 79.58
2 30.43 22.45 77.19 79.35
3 30.89 21.97 76.15 79.96
4 31.77 21.98 76.15 82.08
Log_return=np.log((df)/(df.shift(1))).dropna()
adf=Log_return.values
result = adfuller(adf)
print(result)
通过运行上面的代码,我得到了以下错误。
result = adfuller(adf)
Traceback (most recent call last):
File "<ipython-input-11-224dd4ecd43b>", line 1, in <module>
result = adfuller(adf)
File "C:\Users\Hussnain\Anaconda3\lib\site-packages\statsmodels\tsa\stattools.py", line 221, in adfuller
xdall = lagmat(xdiff[:, None], maxlag, trim='both', original='in')
File "C:\Users\Hussnain\Anaconda3\lib\site-packages\statsmodels\tsa\tsatools.py", line 397, in lagmat
nobs, nvar = xa.shape
ValueError: too many values to unpack (expected 2)