StabilityAssessment.assess_stability#

classmethod StabilityAssessment.assess_stability(ar_coeffs, *, tol=1e-8, allow_unit_roots=False)[source]#

Assess stationarity of an AR/VAR from its autoregressive coefficients.

Builds the (k * p, k * p) companion of \(y_t = A_1 y_{t-1} + \cdots + A_p y_{t-p} + u_t\) and classifies its eigenvalues. Equivalently, tests whether \(\det(I - A_1 z - \cdots - A_p z^p)\) has all its roots outside the unit circle. Deterministic terms and exogenous regressors play no part and must not be included in ar_coeffs.

Empty coefficients (p == 0) short-circuit to the trivial stable record before any validation: tol is not checked on that path and is recorded as 0.0.

Parameters:
  • ar_coeffs (ArrayLike) – Coefficients A_1, ..., A_p; shape (p,) or (p, k, k).

  • tol (float) – Modulus tolerance for classifying unit and explosive roots. A root is a unit root when its modulus is within tol of one. The default suits simple and double unit roots; widen it for higher-order integration (see the module notes).

  • allow_unit_roots (bool) – If True, unit roots are permitted (only strictly explosive roots make the model unstable). Use for VECM and other models that carry unit roots by design.

Return type:

Self

Returns:

The _StabilityAssessment of the companion matrix.

Raises:
  • SpecificationError – If tol is negative and ar_coeffs is non-empty.

  • DimensionError – If ar_coeffs is neither rank 1 nor a stack of square matrices.

  • NumericalError – If ar_coeffs contains non-finite values, or the eigenvalue computation returns them.

Example

>>> res = _StabilityAssessment.assess_stability([0.5])
>>> res.is_stable
True
>>> round(res.max_modulus, 4)
0.5

A bivariate VAR(1) is passed as a (1, 2, 2) stack:

>>> import numpy as np
>>> A = np.array([[[0.5, 0.1], [0.0, 0.4]]])
>>> res = _StabilityAssessment.assess_stability(A)
>>> res.is_stable, round(res.max_modulus, 2), res.eigenvalues.shape
(True, 0.5, (2,))

A unit root is counted, not called explosive, and passes only when it is allowed:

>>> walk = _StabilityAssessment.assess_stability([1.0])
>>> walk.is_stable, walk.n_unit_roots, walk.n_explosive
(False, 1, 0)
>>> _StabilityAssessment.assess_stability([1.0], allow_unit_roots=True).is_stable
True