TimeSeriesSRC.parcor

TimeSeriesSRC.parcor(acf, nump)

Compute the partial autocorrelation function via the Levinson-Durbin algorithm.

Parameters:
  • acf (array-like) – Full (two-sided) autocorrelation sequence with the zero-lag value at the center — i.e., the output of func_xcorr(). Shape (1, 2*L+1) or (2*L+1,).

  • nump (int) – Number of PACF terms to compute (orders 1 through nump).

Returns:

  • pacf (ndarray, shape (1, nump)) – Partial autocorrelation values at orders 1 through nump.

  • phi (ndarray, shape (nump+1, 1)) – Final AR parameter vector from the Levinson recursion.

  • sigma (float) – Residual variance of the AR(nump) model.

Examples

>>> import numpy as np
>>> from scipy.signal import lfilter
>>> from TimeSeriesSRC.basefunctions.xcorr import func_xcorr
>>> from TimeSeriesSRC.basefunctions.parcor import func_parcor
>>> e = np.random.default_rng(0).standard_normal(500)
>>> y = lfilter([1], [1, -0.8], e)
>>> acf = func_xcorr(y, y, 20, 'biased')
>>> pacf, phi, sigma = func_parcor(acf, 10)

See also

xcorr

Compute the autocorrelation sequence.

gpac

Generalized partial autocorrelation table.