StabilityWarning#
- exception cultivars.exceptions.StabilityWarning[source]#
Bases:
UserWarningThe warning category for a fitted model that is non-stationary.
A fit that converged to a companion matrix with a root on or outside the unit circle is still a fit – the estimates are reported, and the result’s
is_stableandstability_check()say what it found – but forecasts, impulse responses and spectral densities from it are not the objects their names promise. This is the category a layer uses when it chooses to warn about that rather than refuse; aUserWarningrather than aCultivarsErrorbecause nothing has failed. Filter it withwarnings.filterwarnings()when the non-stationarity is the point of the exercise. Results also report instability in their summary notes, which are not affected by the filter.See also
NumericalError– raised, not warned, when a computation requires stationarity and does not have it.
Example
The category can be silenced or promoted on its own, leaving other warnings alone:
>>> import warnings >>> with warnings.catch_warnings(record=True) as caught: ... warnings.simplefilter("always") ... warnings.warn("root on the unit circle", StabilityWarning) >>> issubclass(caught[0].category, UserWarning), caught[0].category.__name__ (True, 'StabilityWarning') >>> with warnings.catch_warnings(record=True) as caught: ... warnings.simplefilter("always") ... warnings.filterwarnings("ignore", category=StabilityWarning) ... warnings.warn("root on the unit circle", StabilityWarning) ... warnings.warn("something else", UserWarning) >>> [w.category.__name__ for w in caught] ['UserWarning']