pmdarima.arima
.PPTest¶
-
class
pmdarima.arima.
PPTest
(alpha=0.05, lshort=True)[source][source]¶ Conduct a PP test for stationarity.
In statistics, the Phillips–Perron test (named after Peter C. B. Phillips and Pierre Perron) is a unit root test. It is used in time series analysis to test the null hypothesis that a time series is integrated of order 1. It builds on the Dickey–Fuller test of the null hypothesis
p = 0
.Parameters: alpha : float, optional (default=0.05)
Level of the test
lshort : bool, optional (default=True)
Whether or not to truncate the
l
value in the C code.Notes
This test is generally used indirectly via the
pmdarima.arima.ndiffs()
function, which computes the differencing term,d
.The R code allows for two types of tests: ‘Z(alpha)’ and ‘Z(t_alpha)’. Since sklearn does not allow extraction of std errors from the linear model fit,
t_alpha
is much more difficult to achieve, so we do not allow that variant.References
[R64] R’s tseries PP test source code: http://bit.ly/2wbzx6V 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. should_diff
(x)Test whether the time series is stationary or needs differencing. -
__init__
(alpha=0.05, lshort=True)[source][source]¶ Initialize self. See help(type(self)) for accurate signature.
-
get_params
(deep=True)[source]¶ Get parameters for this estimator.
Parameters: deep : bool, default=True
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]¶ 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.Parameters: **params : dict
Estimator parameters.
Returns: self : object
Estimator instance.
-
should_diff
(x)[source][source]¶ Test whether the time series is stationary or needs differencing.
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.
-