statsmodels.regression.linear_model.yule_walker¶
-
statsmodels.regression.linear_model.yule_walker(x, order=
1, method='adjusted', df=None, inv=False, demean=True)[source]¶ Estimate AR(p) parameters from a sequence using the Yule-Walker equations.
Adjusted or maximum-likelihood estimator (mle)
- Parameters:¶
- x : array_like¶
A 1d array.
- order : int, optional¶
The order of the autoregressive process. Default is 1.
- method : str, optional¶
Method can be ‘adjusted’ or ‘mle’ and this determines denominator in estimate of autocorrelation function (ACF) at lag k. If ‘mle’, the denominator is n=X.shape[0], if ‘adjusted’ the denominator is n-k. The default is adjusted.
- df : int, optional¶
Specifies the degrees of freedom. If df is supplied, then it is assumed the X has df degrees of freedom rather than n. Default is None.
- inv : bool¶
If inv is True the inverse of R is also returned. Default is False.
- demean : bool¶
True, the mean is subtracted from X before estimation.
- Returns:¶
rho (ndarray) – AR(p) coefficients computed using the Yule-Walker method.
sigma (float) – The estimate of the residual standard deviation.
See also
burgBurg’s AR estimator.
Notes
See https://en.wikipedia.org/wiki/Autoregressive_moving_average_model for further details.
Examples
>>> import statsmodels.api as sm >>> from statsmodels.datasets.sunspots import load >>> data = load() >>> rho, sigma = sm.regression.yule_walker(data.endog, order=4, ... method="mle")>>> rho array([ 1.28310031, -0.45240924, -0.20770299, 0.04794365]) >>> sigma 16.808022730464351