UnobservedComponentsResult.simulate#
- UnobservedComponentsResult.simulate(n=200, *, seed=None, burn=0)[source]#
A fresh sample path at the fitted variances.
The unit-root components – level, slope, seasonal – start at zero rather than from the approximate-diffuse initial covariance the filter uses, so the sample is a random walk from the origin and not from a draw of standard deviation a thousand; the cycle starts from its stationary law.
burninitial periods are discarded.- Parameters:
- Return type:
- Returns:
An array of shape
(n,).- Raises:
SpecificationError – If the counts are not usable.
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).fit() >>> path = res.simulate(100, seed=1) >>> path.shape, bool(abs(path[0]) < 3.0) ((100,), True) >>> bool(np.array_equal(path, res.simulate(100, seed=1))) True >>> res.simulate(0) Traceback (most recent call last): cultivars.exceptions.SpecificationError: n must be positive and burn non-negative; ...