ARMAGARCHResult.simulate#

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

A fresh sample path at the fitted parameters.

The variance recursion is the family’s own – linear for GARCH and GJR, in logs for EGARCH – started at the unconditional variance and driven by Gaussian standardized shocks; the conditional mean is applied on top. burn initial periods are discarded so the kept sample does not remember the start.

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

The simulated sample variance is the fitted unconditional variance:

>>> rng = np.random.default_rng(0)
>>> n = 3000
>>> h, y = np.ones(n), np.zeros(n)
>>> for t in range(1, n):
...     h[t] = 0.05 + 0.1 * y[t - 1] ** 2 + 0.85 * h[t - 1]
...     y[t] = np.sqrt(h[t]) * rng.standard_normal()
>>> res = GARCH(y, p=1, q=1).fit()
>>> path = res.simulate(20000, seed=0)
>>> bool(abs(path.var() - res.unconditional_variance) < 0.1)
True