forecasting-ch05-state-spacelisted
Install: claude install-skill KarpelesPublishing/the-art-and-science-of-forecasting
# Chapter 5: The Filter
## Scope and intake
Use when a noisy measurement must track a latent changing level online. Do not use for using a retrospective smoother as if available in real time, or calling a scalar filter a full structural Bayesian model.
Ask only for unresolved material inputs: What latent state is being measured? What are measurement units and timing? How were process variance Q and measurement variance R estimated? Are missing observations or changing sensor quality expected?
## Input contract and additional evidence
A regular series of at least 30 observed values; the target cell may be empty where an observation is missing, and the filter carries the state across the gap. `model` is `local level`, `local linear trend`, `smooth trend` or `local_level_manual` (the hand-rolled filter with fixed `Q` and `R`, complete data only). Set `seasonal` true to add a seasonal component with period `season`, and `cycle` for a stochastic cycle.
Minimal **format illustration**, not sufficient training data:
```csv
timestamp,target
2010-01-01,41.3
2010-02-01,
2010-03-01,44.9
```
## Executable interface
Exact CLI columns: `timestamp,target (empty target allowed)`. Supported method controls: `Q, R, as_of, cycle, frequency, horizon, model, origins, season, seasonal, seed, stochastic_cycle`.
The tool fits a statsmodels unobserved-components model with the chosen level dynamics, optional seasonal and cycle components, and missing observations handled by the Kalman filte