statsmodels.tsa.stattools.innovations_algo¶
-
statsmodels.tsa.stattools.
innovations_algo
(acov, nobs=None, rtol=None)[source]¶ Innovations algorithm to convert autocovariances to MA parameters
- Parameters
- acovarray-like
Array containing autocovariances including lag 0
- nobsint, optional
Number of periods to run the algorithm. If not provided, nobs is equal to the length of acovf
- rtolfloat, optional
Tolerance used to check for convergence. Default value is 0 which will never prematurely end the algorithm. Checks after 10 iterations and stops if sigma2[i] - sigma2[i - 10] < rtol * sigma2[0]. When the stopping condition is met, the remaining values in theta and sigma2 are forward filled using the value of the final iteration.
- Returns
- thetandarray
Innovation coefficients of MA representation. Array is (nobs, q) where q is the largest index of a non-zero autocovariance. theta corresponds to the first q columns of the coefficient matrix in the common description of the innovation algorithm.
- sigma2ndarray
The prediction error variance (nobs,).
See also
References
- *
Brockwell, P.J. and Davis, R.A., 2016. Introduction to time series and forecasting. Springer.
Examples
>>> import statsmodels.api as sm >>> data = sm.datasets.macrodata.load_pandas() >>> rgdpg = data.data['realgdp'].pct_change().dropna() >>> acov = sm.tsa.acovf(rgdpg) >>> nobs = activity.shape[0] >>> theta, sigma2 = innovations_algo(acov[:4], nobs=nobs)