UnobservedComponentsResult._component#
- UnobservedComponentsResult._component(name)[source]#
One component’s smoothed path, or a refusal naming what exists.
The level, slope and cycle are single states and are read off the first index of their block; the seasonal is the sum of its harmonics, read off the block through the design row.
- Parameters:
name (
str) –"level","slope","cycle"or"seasonal".- Return type:
- Returns:
The smoothed path, shape
(n,).- Raises:
SpecificationError – If the specification lacks the component.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> y = np.cumsum(0.2 * rng.standard_normal(200)) + rng.standard_normal(200) >>> res = UnobservedComponents(y, trend="level").fit() >>> res._component("level").shape (200,) >>> res._component("cycle") Traceback (most recent call last): cultivars.exceptions.SpecificationError: this specification has no cycle component; ...