TimeSeriesSRC.gpac¶
- TimeSeriesSRC.gpac(acf, nrows, ncols)¶
Compute the Generalized Partial Autocorrelation (GPAC) table.
Each cell
(j, m)of the GPAC is the ratio of two determinants built from the ACF, following the Woodward & Gray (1981) construction. The table simultaneously identifies the MA order (row index + 1) and AR order (column index + 1) of an ARMA process: cells in an MA(q) column pattern or AR(p) row pattern help select model orders.- Parameters:
acf (array-like, shape (1, 2*L+1) or (2*L+1,) or (2*L,)) – Autocorrelation sequence. If two-sided (zero lag at center), the positive-lag half is extracted automatically. If one-sided (zero lag first), it is used directly.
nrows (int) – Number of GPAC rows (numerator orders 1 .. nrows).
ncols (int) – Number of GPAC columns (denominator orders 1 .. ncols).
- Returns:
gpac_array – GPAC table. Row
jcorresponds to MA orderj+1; columnmcorresponds to AR orderm+1.- Return type:
ndarray, shape (nrows, ncols)
Notes
If
nrows + ncolsexceeds the half-length of the ACF,ncolsis silently truncated and aUserWarningis issued.Examples
>>> import numpy as np >>> from scipy.signal import lfilter >>> from TimeSeriesSRC.basefunctions.xcorr import func_xcorr >>> from TimeSeriesSRC.basefunctions.gpac import func_gpac >>> e = np.random.default_rng(0).standard_normal(500) >>> y = lfilter([1], [1, -0.8], e) >>> acf = func_xcorr(y, y, 25, 'biased') >>> G = func_gpac(acf, nrows=5, ncols=5) >>> G.shape (5, 5)
See also
plotgpacVisualize the GPAC table.
uniAnalComputes and plots ACF, PACF, and GPAC together.