Skip to content

plot_pacf


method plot_pacf(columns=None, nlags=None, method="ywadjusted", plot_interval=True, title=None, legend="upper right", figsize=None, filename=None, display=True)[source]
Plot the partial autocorrelation function.

The partial autocorrelation function (PACF) measures the correlation between a time series and lagged versions of itself, after removing the effects of shorter lagged values. In other words, it represents the correlation between two variables while controlling for the influence of other variables. PACF can help to identify the order of the autoregressive (AR) process in a time series model. This plot is only available for forecast tasks.

Parameterscolumns: int, str, segment, sequence, dataframe or None, default=None
Columns to plot the pacf from. If None, it selects the target column.

nlags: int or None, default=None
Number of lags to return autocorrelation for. If None, it uses min(10 * np.log10(len(y)), len(y) // 2 - 1). The returned value includes lag 0 (i.e., 1), so the size of the vector is (nlags + 1,).

method : str, default="ywadjusted"
Specifies which method to use for the calculations.

  • "yw" or "ywadjusted": Yule-Walker with sample-size adjustment in denominator for acovf.
  • "ywm" or "ywmle": Yule-Walker without an 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.
  • "burg": Burg"s partial autocorrelation estimator.

plot_interval: bool, default=True
Whether to plot the 95% confidence interval.

title: str, dict or None, default=None
Title for the plot.

legend: str, dict or None, default="upper right"
Legend for the plot. See the user guide for an extended description of the choices.

  • If None: No legend is shown.
  • If str: Position to display the legend.
  • If dict: Legend configuration.

figsize: tuple or None, default=None
Figure's size in pixels, format as (x, y). If None, it adapts the size to the number of lags shown.

filename: str, Path or None, default=None
Save the plot using this name. Use "auto" for automatic naming. The type of the file depends on the provided name (.html, .png, .pdf, etc...). If filename has no file type, the plot is saved as html. If None, the plot is not saved.

display: bool or None, default=True
Whether to render the plot. If None, it returns the figure.

Returnsgo.Figure or None
Plot object. Only returned if display=None.


See Also

plot_acf

Plot the autocorrelation function.

plot_decomposition

Plot the trend, seasonality and residuals of a time series.

plot_series

Plot a data series.


Example

>>> from atom import ATOMForecaster
>>> from sktime.datasets import load_airline

>>> y = load_airline()

>>> atom = ATOMForecaster(y, random_state=1)
>>> atom.plot_pacf()