Reputation: 1059
I have the following code snippet for performing the adfuller test on my time series
def dickey_fuller(series):
X = series
result = adfuller(X, regression='ct')
print('ADF Statistic: %f' % result[0])
print('p-value: %f' % result[1])
print('Lags used: %d' % result[2])
print('Critical Values:')
for key, value in result[4].items():
print('%s: %.3f' % (key, value))
print('-----------------------------------------------')
Those are the adfuller values by default:
statsmodels.tsa.stattools.adfuller(x, maxlag=None, regression='c', autolag='AIC', store=False, regresults=False)
As cited in the statsmodels docs, when we have autolag='AIC'
it will choose the number of lags that minimize the information criterion.
The following is a sample output of my run of this test on my data:
ADF Statistic: -7.359845
p-value: 0.000000
Lags used: 7
Critical Values:
1%: -4.021
5%: -3.441
10%: -3.145
I am interested in including the appropriate number of lags as column in my data, and here the used number of lags is 7. In this case, shall I take all lags from 1 up to 7 or shall I take only the 7th lag?
Or in other words, is the returned number of lags the lag length or the best lag taken ?
Upvotes: 0
Views: 1289
Reputation: 2410
Per the docs it returns the number of lagS used. But typically, when talking about such models, somethink like : AR(2) refers to an autogressive model using two lags. If you use some lags like every other seventh or twelveth lag, it's a seasonal component.
Upvotes: 1