I am testing the stationary using adf test for pair trading, and found that the results of the Adfuller test in statsmodels.tsa.stattools are different under different Python versions。
In python 3.8:
from statsmodels.tsa.stattools
import adfuller
data = [1, 2, 3, 4, 5, 6, 7, 8,9, 10, 11]
result = adfuller(data)
result[1]
print(f"ADF Statistic: {result[0]}") ADF Statistic: 1.0458250331675945
print(f"p-value: {result[1]}") p-value: 0.9947266780527716
In Python 3.12
from statsmodels.tsa.stattools import adfuller
data = [1, 2, 3, 4, 5, 6, 7, 8,9, 10, 11]
result = adfuller(data)
print(f"ADF Statistic: {result[0]}") ADF Statistic: -1.9028109877684682
print(f"p-value: {result[1]}") p-value: 0.330739891075021
Why the same code lead to different p value?
Thanks