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:
xarray_like

A 1d array.

orderint, optional

The order of the autoregressive process. Default is 1.

methodstr, 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.

dfint, 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.

invbool

If inv is True the inverse of R is also returned. Default is False.

demeanbool

True, the mean is subtracted from X before estimation.

Returns:
rhondarray

AR(p) coefficients computed using the Yule-Walker method.

sigmafloat

The estimate of the residual standard deviation.

See also

burg

Burg’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

Last update: Mar 18, 2024