UnobservedComponentsResult.slope#

property UnobservedComponentsResult.slope: NDArray[float64][source]#

The smoothed trend slope \(E[\beta_t \mid y]\), shape (n,).

Raises:

SpecificationError – If the trend is a local level, which has no slope.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(7)
>>> slope = np.cumsum(0.01 * rng.standard_normal(300))
>>> y = np.cumsum(slope) + 0.5 * rng.standard_normal(300)
>>> res = UnobservedComponents(y, trend="smooth").fit()
>>> bool(np.corrcoef(res.slope, slope)[0, 1] > 0.95)
True
>>> UnobservedComponents(y, trend="level").fit().slope
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: this specification has no slope component; ...