statsmodels.tsa.stattools.pacf#

statsmodels.tsa.stattools.pacf(x, nlags=None, method='ywadjusted', alpha=None, *, use_namedtuple=None)[source]#

Partial autocorrelation estimate

Parameters:
xarray_like

Observations of time series for which pacf is calculated.

nlagsint, optional

Number of lags to return autocorrelation for. If not provided, uses min(10 * np.log10(nobs), nobs // 2 - 1). The returned value includes lag 0 (ie., 1) so size of the pacf vector is (nlags + 1,).

methodstr, default “ywadjusted”

Specifies which method for the calculations to use.

  • “yw” or “ywadjusted” : Yule-Walker with sample-size adjustment in denominator for acovf. Default.

  • “ywm” or “ywmle” : Yule-Walker without adjustment.

  • “ols” : regression of time series on lags of it and on constant.

  • “ols-inefficient” : regression of time series on lags using a single common sample to estimate all pacf coefficients.

  • “ols-adjusted” : regression of time series on lags with a bias adjustment.

  • “ld” or “ldadjusted” : Levinson-Durbin recursion with bias correction.

  • “ldb” or “ldbiased” : Levinson-Durbin recursion without bias correction.

  • “burg” : Burg’s partial autocorrelation estimator.

alphafloat, optional

If a number is given, the confidence intervals for the given level are returned. For instance if alpha=.05, 95 % confidence intervals are returned where the standard deviation is computed according to 1/sqrt(len(x)).

use_namedtuplebool, optional

Flag controlling whether a PacfResult NamedTuple is returned. When alpha is not None a PacfResult is always returned; it holds the same two elements as the legacy tuple, so it unpacks and indexes identically. When alpha is None a bare array is returned unless use_namedtuple=True, which additionally yields a PacfResult with confint set to None.

Returns:
PacfResult or ndarray

When alpha is not None (or use_namedtuple=True), a NamedTuple with fields:

pacfndarray

The partial autocorrelations for lags 0, 1, …, nlags. Shape (nlags+1,).

confintndarray or None

Confidence intervals for the PACF at lags 0, 1, …, nlags. Shape (nlags + 1, 2). None when alpha is None.

PacfResult has the same length and contents as the plain (pacf, confint) tuple it replaces, so it unpacks and indexes identically. See PacfResult.

When alpha is None a bare ndarray of partial autocorrelations is returned instead.

See also

statsmodels.tsa.stattools.acf

Estimate the autocorrelation function.

statsmodels.tsa.stattools.pacf_yw

Partial autocorrelation estimation using Yule-Walker.

statsmodels.tsa.stattools.pacf_ols

Partial autocorrelation estimation using OLS.

statsmodels.tsa.stattools.pacf_burg

Partial autocorrelation estimation using Burg’s method.

statsmodels.graphics.tsaplots.plot_pacf

Plot partial autocorrelations and confidence intervals.

Notes

Based on simulation evidence across a range of low-order ARMA models, the best methods based on root MSE are Yule-Walker (MLW), Levinson-Durbin (MLE) and Burg, respectively. The estimators with the lowest bias included included these three in addition to OLS and OLS-adjusted.

Yule-Walker (adjusted) and Levinson-Durbin (adjusted) performed consistently worse than the other options.