MarkovSwitchingARResult.simulate#

MarkovSwitchingARResult.simulate(n=200, *, seed=None, burn=_SIMULATION_BURN)[source]#

A fresh sample path at the fitted parameters.

The regime chain is started from its ergodic distribution and stepped through the fitted transition matrix; within each regime the series follows that regime’s intercept, autoregression and innovation variance. burn initial periods are discarded. Use simulate_regimes() to keep the regime path as well.

Parameters:
  • n (int) – Observations kept.

  • seed (int | Generator | None) – Seed or generator.

  • burn (int) – Periods discarded from the start.

Return type:

NDArray[double]

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)
>>> res = MarkovSwitchingAR(rng.standard_normal(300), order=1).fit(seed=0, n_init=2)
>>> res.simulate(50, seed=1).shape
(50,)
>>> res.simulate(0)
Traceback (most recent call last):
    ...
cultivars.exceptions.SpecificationError: n must be positive and burn non-negative; ...