StabilityAssessment.assess_stability_from_companion#
- classmethod StabilityAssessment.assess_stability_from_companion(companion, *, tol=1e-8, allow_unit_roots=False)[source]#
Assess stability directly from a companion (or state-transition) matrix.
For callers that already hold the matrix whose powers drive the recursion: a companion built elsewhere, or the transition matrix of a linear Gaussian state-space model. No companion structure is assumed or verified; any square real matrix is accepted and read as \(x_t = T x_{t-1} + \cdots\).
Unlike
assess_stability(), an empty(0, 0)matrix is not short-circuited:tolis validated and recorded on the returned record.- Parameters:
- Return type:
- Returns:
The
_StabilityAssessmentofcompanion.- Raises:
DimensionError – If
companionis not a square 2-D array.SpecificationError – If
tolis negative.NumericalError – If the eigenvalue computation returns non-finite values.
numpy.linalg.LinAlgError – If
companioncontains non-finite entries. Unlikeassess_stability(), the input is not screened here, so NumPy’s own exception propagates.
Example
A local-linear-trend transition has a double unit root and nothing explosive:
>>> import numpy as np >>> T = np.array([[1.0, 1.0], [0.0, 1.0]]) >>> res = _StabilityAssessment.assess_stability_from_companion( ... T, allow_unit_roots=True ... ) >>> res.is_stable, res.n_unit_roots, res.n_explosive (True, 2, 0) >>> _StabilityAssessment.assess_stability_from_companion(T).is_stable False