W3cubDocs

/Statsmodels

statsmodels.regression.linear_model.yule_walker

statsmodels.regression.linear_model.yule_walker(X, order=1, method='unbiased', df=None, inv=False, demean=True) [source]

Estimate AR(p) parameters from a sequence X using Yule-Walker equation.

Unbiased or maximum-likelihood estimator (mle)

See, for example:

http://en.wikipedia.org/wiki/Autoregressive_moving_average_model

Parameters:
  • X (array-like) – 1d array
  • order (integer, optional) – The order of the autoregressive process. Default is 1.
  • method (string, optional) – Method can be ‘unbiased’ 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 ‘unbiased’ the denominator is n-k. The default is unbiased.
  • df (integer, 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 – The autoregressive coefficients
  • sigma – TODO

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

© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.regression.linear_model.yule_walker.html