StabilityAssessment#
- class cultivars.diagnostics.stability.StabilityAssessment(eigenvalues, max_modulus, is_stable, n_unit_roots, n_explosive, tol)[source]#
The outcome of a stability (or invertibility) assessment.
A deterministic reading of a coefficient array or a transition matrix: the companion eigenvalues, their largest modulus, a count of the roots on and beyond the unit circle, and the verdict under the criterion the caller asked for. There is no null hypothesis and no sampling variation in it. Instances are built by the class methods, not by the constructor, which performs no validation and does not check that the fields agree with one another.
The record does not store which criterion produced
is_stable. The counts are criterion-free, so the other verdict can always be recovered: the permissive one isn_explosive == 0and the strict one ismax_modulus < 1 - tol.The dataclass is frozen, so fields cannot be rebound, but
eigenvaluesis an ordinary writeable array and is not copied on access. Because that field is an array, the generated__eq__raisesValueErrorwhen two records with more than one eigenvalue are compared and__hash__raisesTypeError; compare fields, not records.- Variables:
eigenvalues (
NDArray[cdouble]) – The companion eigenvalues (complex), shape(k * p,)in the order NumPy returns them, which is not sorted by modulus. Empty when there are no lags.max_modulus (
float) – The largest eigenvalue modulus;0.0when there are no eigenvalues (p == 0).is_stable (
bool) – Whether the requested stability criterion is satisfied. Withallow_unit_roots=Falsethis means all moduli are strictly below1 - tol; withallow_unit_roots=Trueit means no modulus exceeds1 + tol.n_unit_roots (
int) – Number of eigenvalues whose modulus is withintolof 1.n_explosive (
int) – Number of eigenvalues with modulus above1 + tol.tol (
float) – The modulus tolerance used for classification. Recorded as0.0on the trivial record thatassess_stability()returns for empty coefficients, whatever tolerance was passed.
See also
GVARResult.stability_check()– returns an instance.VECMResult.stability_check()– returns an instance.VECMXResult.stability_check()– returns an instance.MFVARResult.stability_check()– returns an instance.
Example
>>> res = _StabilityAssessment.assess_stability([0.5, -0.3]) >>> res.is_stable, res.n_unit_roots, res.n_explosive (True, 0, 0) >>> round(res.max_modulus, 4) 0.5477 >>> walk = _StabilityAssessment.assess_stability([1.0]) >>> walk.is_stable, walk.n_unit_roots, walk.n_explosive (False, 1, 0)
Attributes#
Companion eigenvalues, shape |
|
the largest eigenvalue modulus. |
|
Verdict under the criterion the producer was asked for. |
|
Number of eigenvalues with \(\bigl|\, |\lambda| - 1 \,\bigr| \le \mathrm{tol}\). |
|
Number of eigenvalues with modulus above |
|
Half-width of the unit-root band around modulus one used to classify. |
Methods#
|
Assess stationarity of an AR/VAR from its autoregressive coefficients. |
|
Assess stability directly from a companion (or state-transition) matrix. |
|
Is an MA/ARMA invertible? (companion of the MA polynomial, roots inside). |
|
Convenience predicate: is the AR/VAR strictly stationary? |