TimeSeriesSRC.uniAnal¶
- TimeSeriesSRC.uniAnal(y, na=20, nump=10, nrg=5, ncg=0, diff=[0], per=[], perdsp=1)¶
Compute and plot the ACF, PACF, and GPAC for a univariate time series.
Differences the series as requested, computes the autocorrelation (ACF), partial autocorrelation (PACF), and generalized partial autocorrelation (GPAC) functions, and produces stem/GPAC plots for order identification.
- Parameters:
y (array-like) – 1-D time series.
na (int, optional) – Maximum lag for ACF; lags range from
-nato+na. Default 20.nump (int, optional) – Number of PACF terms to compute (lags 1 .. nump). Default 10.
nrg (int, optional) – Number of GPAC rows (numerator orders). Default 5.
ncg (int, optional) – Number of GPAC columns (denominator orders); 0 sets it equal to
nrg. Default 0.diff (list of int, optional) – Differencing orders to apply before analysis. Must satisfy
len(diff) == len(per) + 1. Default[0].per (list of int, optional) – Seasonal periods. Used with
diff— must have one fewer element. Default[].perdsp (int, optional) – Display period — ACF and PACF are sampled at every
perdsp-th lag. Default 1.
- Returns:
yacf (ndarray, shape (1, 2*na+1)) – Biased ACF from lag
-nato+na.ypacf (ndarray, shape (1, nump)) – Partial ACF from lag 1 to
nump.ygpac (ndarray, shape (nrg, ncg)) – GPAC table (row = numerator order, column = denominator order).
Examples
>>> import numpy as np >>> from scipy.signal import lfilter >>> from TimeSeriesSRC.basefunctions.uniAnal import func_uniAnal >>> e = np.random.default_rng(0).standard_normal(500) >>> y = lfilter([1], [1, -0.8], e) >>> yacf, ypacf, ygpac = func_uniAnal(y, na=20, nump=10, nrg=5)