pyhctsa.operations.correlation.partial_autocorr¶
-
pyhctsa.operations.correlation.partial_autocorr(y, max_tau=
10, what_method='burg')¶ Compute the partial autocorrelation of an input time series.
Computes the partial autocorrelation at lags 1 to
max_tau: the correlation between y(t) and y(t-k) after removing the linear effect of the intermediate values (the last coefficient of an order-k autoregressive fit).The default (
'burg') is the sequence of reflection coefficients of Burg’s recursion: at each order, the coefficient minimizing the summed forward and backward prediction errors, which has a closed form and is bounded in [-1, 1]. It needs no matrix solve, so it is the same in any implementation (it is exact against hctsa’sCO_PartialAutoCorr), and it agrees closely with the ordinary-least-squares partial autocorrelation. The latter ('ols') regresses y(t) on k lagged values; for smooth, nearly deterministic series its design matrix is numerically singular and the coefficient depends on the linear solver.For
'burg', each order k uses the N-k forward errors f(t) and the matching backward errors b(t-1) of the order k-1 fit: the reflection coefficient is2*sum(f*b)/(sum(f^2) + sum(b^2)), the partial autocorrelation at lag k is its value, and both error series are then updated with it. A constant series gives zeros, and prediction errors below 1e-8 of the energy of the series (rounding-level noise, as for an exactly predictable sinusoid) are not allowed to produce coefficients of up to +-1. Lags of N or more are NaN.- Parameters:¶
- y : array-like¶
The input time series.
- max_tau : int, optional¶
Maximum time-delay to compute PACF values for. Default is 10.
- what_method : {'burg', 'ols', 'yule-walker'}, optional¶
Method to compute partial autocorrelation:
'burg': Burg recursion (the default, as in hctsa).'ols': Ordinary least squares regression.'yule-walker': Yule-Walker equations method (not in hctsa).
Default is
'burg'.
- Returns:¶
Dictionary containing partial autocorrelations for each lag, with keys:
’pac_1’: PACF at lag 1
’pac_2’: PACF at lag 2
…up to maxTau
- Return type:¶
dict