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 inar_coeffs.Empty coefficients (
p == 0) short-circuit to the trivial stable record before any validation:tolis not checked on that path and is recorded as0.0.- Parameters:
ar_coeffs (
ArrayLike) – CoefficientsA_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 withintolof one. The default suits simple and double unit roots; widen it for higher-order integration (see the module notes).allow_unit_roots (
bool) – IfTrue, 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:
- Returns:
The
_StabilityAssessmentof the companion matrix.- Raises:
SpecificationError – If
tolis negative andar_coeffsis non-empty.DimensionError – If
ar_coeffsis neither rank 1 nor a stack of square matrices.NumericalError – If
ar_coeffscontains 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: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