integration_order#

impulso.integration_order(data, variables=None, *, max_order=2, alpha=0.05, regression='c')[source]#

Determine each series’ integration order by repeated differencing.

For every variable the series is tested at its level, then differenced and re-tested, until ADF rejects a unit root or max_order is reached. ADF drives the stopping rule. KPSS is run at every level as a cross-check and recorded in a joint_status column; where the two disagree, or where a series is still non-stationary at max_order, the variable is listed in inconclusive and the reported order should not be used without looking at the table.

The returned d_max is the augmentation term a Toda-Yamamoto style procedure needs. Check inconclusive before using it: where a variable is listed there, its order — and therefore d_max — is a placeholder.

Parameters:
  • data (VARData | DataFrame | Series) – VARData (endogenous block only), DataFrame, or Series.

  • variables (Sequence[str] | None) – Subset of column names to test. Defaults to all.

  • max_order (int) – Highest order to search.

  • alpha (float) – Significance level for both tests. Restricted to the levels KPSS tabulates: 0.10, 0.05, 0.025, or 0.01.

  • regression (Literal['c', 'ct']) – Deterministic terms for the level test only. Pass “ct” when the levels trend. Differenced series are always tested with a constant, since differencing removes a linear trend.

Returns:

IntegrationOrderResult with per-variable orders and the full table.

Raises:

ValueError – If max_order is negative, regression is invalid, or alpha is not a level KPSS tabulates.

Return type:

IntegrationOrderResult

Expand for references to impulso.integration_order

Stationarity Pitfalls in Climate Data / Anomalies do not make a series stationary

Granger Causality and Toda-Yamamoto / A worked example, and what it does not license

Granger Causality and Toda-Yamamoto / Toda-Yamamoto for integrated systems / The manual route

Granger Causality and Toda-Yamamoto / Toda-Yamamoto for integrated systems / When it refuses

Testing for Stationarity and Cointegration / Integration order

Model Checks and Validation