pmdarima.arima.ADFTest

class pmdarima.arima.ADFTest(alpha=0.05, k=None)[source][source]

Conduct an ADF test for stationarity.

In statistics and econometrics, an augmented Dickey–Fuller test (ADF) tests the null hypothesis of a unit root is present in a time series sample. The alternative hypothesis is different depending on which version of the test is used, but is usually stationarity or trend-stationarity. It is an augmented version of the Dickey–Fuller test for a larger and more complicated set of time series models.

Parameters:

alpha : float, optional (default=0.05)

Level of the test

k : int, optional (default=None)

The drift parameter. If k is None, it will be set to: np.trunc(np.power(x.shape[0] - 1, 1 / 3.0))

Notes

This test is generally used indirectly via the pmdarima.arima.ndiffs() function, which computes the differencing term, d.

ADF test does not perform as close to the R code as do the KPSS and PP tests. This is due to the fact that is has to use statsmodels OLS regression for std err estimates rather than the more robust sklearn LinearRegression.

References

[R18]https://wikipedia.org/wiki/Augmented_Dickey–Fuller_test
[R19]R’s tseries ADF source code: https://bit.ly/2EnvM5V

Methods

get_params([deep]) Get parameters for this estimator.
is_stationary(x) Test whether the time series is stationary.
set_params(**params) Set the parameters of this estimator.
__init__(alpha=0.05, k=None)[source][source]

Initialize self. See help(type(self)) for accurate signature.

get_params(deep=True)[source]

Get parameters for this estimator.

Parameters:

deep : boolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params : mapping of string to any

Parameter names mapped to their values.

is_stationary(x)[source][source]

Test whether the time series is stationary.

Parameters:

x : array-like, shape=(n_samples,)

The time series vector.

Returns:

pval : float

The computed P-value of the test.

sig : bool

Whether the P-value is significant at the alpha level. More directly, whether to difference the time series.

set_params(**params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:self