필터 지우기
필터 지우기

For the same input configurations, can the ADF test within MATLAB R2022a give different results compared to the ADF test in Python 3.10 (statsmodels package)?

조회 수: 5 (최근 30일)
Assuming that we have the same data, maximum number of lags, model variant and AIC as information criterion, can it be that the Augmented Dickey-Fuller test gives a different value of the AIC value comparing it with the AIC value that is returned for the same test in Python 3.10?
Suppose that for a given data sequence y, we execute:
adftest(y, 'model', 'AR', 'lags', linspace(1,8,8), 'alpha', 0.1);
We select the p-value of the number of lags based on the smallest AIC value.
The equivalent of the above line in Python is:
import statsmodels.tsa.stattools as st
st.adfuller(y, maxlag=8, regression='n', autolag="AIC") % Can also be regression = 'c'
In Python, the best p-value is obtained based on the AIC value.
Comparing these two tests, one obtains different results.
I am currently researching these differences and have the intuition that the AIC value is calculated differently within the statsmodel package of Python. The difference is of significance as for the same data, a different conclusion of the hypothesis is returned. I have checked the input and tried each possible input configuration within Python, however the AIC outcome for each lag is significantly different.
It seems that the log-likelihood function used for the AIC is completely different within MATLAB, than in this particular software. Is there a valid reason for this difference? Is the implementation of the adftest significantly different from implementations in other software?

답변 (1개)

Karanjot
Karanjot 2023년 9월 27일
Hi Kerim,
I understand that you want to know about the differences in implementation of Augmented Dickey-Fuller test in MATLAB and Python ‘statsmodels’ package.
The AIC values obtained from the Augmented Dickey-Fuller (ADF) test can differ between MATLAB and Python's ‘statsmodels’ library due to variations in the underlying implementations of the test and the calculation of the log-likelihood function. These differences can arise from variations in algorithmic details, numerical methods, and default settings.
I recommend you go through the ‘More About’ section in the MathWorks documentation for ‘adftest’ function:
Also check the ‘Notes’ & ‘References’ section in the documentation below to identify differences in the implementation which could result in varying results.
I hope this helps!

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by