VARMA._recursive_innovations#
- VARMA._recursive_innovations(deterministic, ar, ma)[source]#
Innovations implied by a parameter draw, computed forward in time.
Pre-sample innovations are set to zero; under an invertible moving-average block their influence decays geometrically, which is exactly why the caller checks invertibility before trusting this.
- Parameters:
- Return type:
- Returns:
An
(nobs, k)array, zero for the firstprows.
Example
At the true parameters the recursion recovers the innovations that generated the sample almost exactly:
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> u = rng.standard_normal((302, 2)) >>> y = np.zeros((302, 2)) >>> for t in range(1, 302): ... y[t] = 0.5 * y[t - 1] + u[t] + 0.4 * u[t - 1] >>> model = VARMA(y[2:], order=(1, 1)) >>> ar, ma = 0.5 * np.eye(2)[None], 0.4 * np.eye(2)[None] >>> recovered = model._recursive_innovations(np.zeros((1, 2)), ar, ma) >>> recovered.shape, bool(np.allclose(recovered[0], 0.0)) ((300, 2), True) >>> bool(np.corrcoef(recovered[50:, 0], u[52:, 0])[0, 1] > 0.99) True