Back to models
Transformer

PartialAutoCorrelationTransformer

Partial auto-correlation transformer.

The partial autocorrelation function measures the conditional correlation between a timeseries and its self at different lags. In particular, the correlation between a time period and a lag, is calculated conditional on all the points between the time period and the lag.

The PartialAutoCorrelationTransformer returns these values as a series for each lag up to the n_lags specified.

Quickstart

python
from sktime.transformations.acf import PartialAutoCorrelationTransformer

estimator = PartialAutoCorrelationTransformer(n_lags=None, method='ywadjusted')

Tags

Capabilities

  • Unequal-length series
  • Multivariate: Not supported
  • Inverse transform: Not supported
  • Missing values: Not supported
  • Removes missing values: Not supported
  • Equalizes series length: Not supported

Properties

Input typescitype:transform-input
Series
Output typescitype:transform-output
Series
Label typescitype:transform-labels
None
Fit is emptyfit_is_empty
Yes
Keeps the time indextransform-returns-same-time-index
No
Requires Xrequires_X
Yes
Requires yrequires_y
No
X and y need the same indexX-y-must-have-same-index
No

Parameters(2)

n_lagsint, default=None
Number of lags to return partial autocorrelation for. If None, statsmodels acf function uses min(10 * np.log10(nobs), nobs // 2 - 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.

Examples

>>> from sktime.transformations.acf import PartialAutoCorrelationTransformer
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>> transformer = PartialAutoCorrelationTransformer (n_lags = 12)
>>> y_hat = transformer. fit_transform (y)