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: tol is validated and recorded on the returned record.

Parameters:
  • companion (ArrayLike) – A square matrix (e.g. a companion or an LGSS transition matrix).

  • tol (float) – Modulus tolerance for classifying unit and explosive roots.

  • allow_unit_roots (bool) – If True, unit roots are permitted. Use for transitions with random-walk or other integrated states.

Return type:

Self

Returns:

The _StabilityAssessment of companion.

Raises:
  • DimensionError – If companion is not a square 2-D array.

  • SpecificationError – If tol is negative.

  • NumericalError – If the eigenvalue computation returns non-finite values.

  • numpy.linalg.LinAlgError – If companion contains non-finite entries. Unlike assess_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