mojolearn.kpss_test#
- mojolearn.kpss_test(y, d=0, D=0, s=0, pval_threshold=0.05, return_statistic=False)[source]#
KPSS stationarity test for a batch of series.
Differences each series (
dsimple andDseasonal differences) and runs the KPSS test, followingcuml.tsa.stationarity.kpss_test. Series are given in columns, as in cuML. Computation is float32; float64 input is converted (and copied). Non-finite values raise an error naming the index, where cuML lets them reach the statistic. A constant series has statistic 0.0 and is judged stationary.- Parameters:
y (array-like of shape (n_obs, n_series) or (n_obs,)) – The series, one per column; 1-D is one series.
d (int, default 0) – Order of simple differencing.
D (int, default 0) – Order of seasonal differencing;
D > 0needss >= 2.d + Dis at most 2.s (int, default 0) – Seasonal period.
pval_threshold (float, default 0.05) – Significance level.
return_statistic (bool, default False) – Also return the test statistic (cuML returns the flags only).
- Returns:
stationary (Array of shape (n_series,), uint8) – 1 where the series is judged stationary after differencing, else 0.
statistic (Array of shape (n_series,), float32) – The KPSS statistic; returned only when
return_statistic=True.
Examples
>>> import numpy as np, mojolearn >>> y = np.random.default_rng(0).standard_normal((200, 4)).astype(np.float32) >>> np.asarray(mojolearn.kpss_test(y)).shape (4,)