Loading...

vastorbit.VastFrame.pacf

VastFrame.pacf(column: str, ts: str, by: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, p: int | list = 5, unit: str = 'rows', method: Literal['pearson', 'kendall', 'spearman', 'spearmand', 'biserial', 'cramer'] = 'pearson', confidence: bool = True, alpha: float = 0.95, show: bool = True, kind: Literal['line', 'bar'] = 'bar', chart: PlottingBase | TableSample | Axes | mFigure | Figure | None = None, **style_kwargs)

Computes the partial autocorrelations of the specified VastColumn. Partial autocorrelations are a fundamental concept in time series analysis and provide essential information about the dependencies between data points at different time lags. Understanding these partial autocorrelations can aid in modeling and predicting future values, making it a valuable tool for time series analysis and forecasting.

Parameters:
  • column (str) – Input VastColumn used to compute the Auto Correlation Plot.

  • ts (str) – TS (Time Series) VastColumn used to order the data. It can be of type date or a numerical VastColumn.

  • by (SQLColumns, optional) – VastColumns used in the partition.

  • p (int | list, optional) – Int equal to the maximum number of lag to consider during the computation or List of the different lags to include during the computation. p must be positive or a list of positive integers.

  • unit (str, optional) –

    Unit used to compute the lags.

    • rows:

      Natural lags.

    • else:

      Any time unit. For example, you can write ‘hour’ to compute the hours lags or ‘day’ to compute the days lags.

  • method (str, optional) –

    Method used to compute the correlation.

    • pearson:

      Pearson’s correlation coefficient (linear).

    • spearman:

      Spearman’s correlation coefficient (monotonic - rank based).

    • spearmanD:

      Spearman’s correlation coefficient using the DENSE RANK function instead of the RANK function.

    • kendall:

      Kendall’s correlation coefficient (similar trends). The method computes the Tau-B coefficient.

      Warning

      This method uses a CROSS JOIN during computation and is therefore computationally expensive at O(n * n), where n is the total count of the VastFrame.

    • cramer:

      Cramer’s V (correlation between categories).

    • biserial:

      Biserial Point (correlation between binaries and a numericals).

  • confidence (bool, optional) – If set to True, the confidence band width is drawn.

  • alpha (float, optional) – Significance Level. Probability to accept H0. Only used to compute the confidence band width.

  • show (bool, optional) – If set to True, the Plotting object is returned.

  • kind (str, optional) –

    PACF Type.

    • bar:

      Classical Partial Autocorrelation Plot using bars.

    • line:

      Draws the PACF using a Line Plot.

  • chart (PlottingObject, optional) – The chart object used to plot.

  • **style_kwargs – Any optional parameter to pass to the plotting functions.

Returns:

Plotting Object.

Return type:

obj

Examples

Import the amazon dataset from vastorbit.

from vastorbit.datasets import load_amazon

data = load_amazon()
📅
date
Date
Abc
state
Varchar(32)
123
number
Integer
12016-01-01PARAÍBA18
22016-02-01PARAÍBA4
32016-03-01PARAÍBA1
42016-04-01PARAÍBA1
52016-05-01PARAÍBA1
62016-06-01PARAÍBA4
72016-07-01PARAÍBA22
82016-08-01PARAÍBA50
92016-09-01PARAÍBA131
102016-10-01PARAÍBA304
112016-11-01PARAÍBA132
122016-12-01PARAÍBA8
132016-01-01PARÁ1322
142016-02-01PARÁ430
152016-03-01PARÁ81
162016-04-01PARÁ66
172016-05-01PARÁ154
182016-06-01PARÁ502
192016-07-01PARÁ1579
202016-08-01PARÁ4863
212016-09-01PARÁ3953
222016-10-01PARÁ5281
232016-11-01PARÁ7879
242016-12-01PARÁ3300
252016-01-01PERNAMBUCO24
262016-02-01PERNAMBUCO19
272016-03-01PERNAMBUCO4
282016-04-01PERNAMBUCO8
292016-05-01PERNAMBUCO6
302016-06-01PERNAMBUCO4
312016-07-01PERNAMBUCO17
322016-08-01PERNAMBUCO42
332016-09-01PERNAMBUCO171
342016-10-01PERNAMBUCO319
352016-11-01PERNAMBUCO191
362016-12-01PERNAMBUCO161
372016-01-01PIAUÍ94
382016-02-01PIAUÍ97
392016-03-01PIAUÍ53
402016-04-01PIAUÍ35
412016-05-01PIAUÍ60
422016-06-01PIAUÍ153
432016-07-01PIAUÍ754
442016-08-01PIAUÍ1647
452016-09-01PIAUÍ1394
462016-10-01PIAUÍ2598
472016-11-01PIAUÍ1126
482016-12-01PIAUÍ374
492016-01-01RIO DE JANEIRO9
502016-02-01RIO DE JANEIRO16
512016-03-01RIO DE JANEIRO16
522016-04-01RIO DE JANEIRO45
532016-05-01RIO DE JANEIRO30
542016-06-01RIO DE JANEIRO37
552016-07-01RIO DE JANEIRO131
562016-08-01RIO DE JANEIRO241
572016-09-01RIO DE JANEIRO195
582016-10-01RIO DE JANEIRO30
592016-11-01RIO DE JANEIRO19
602016-12-01RIO DE JANEIRO5
612016-01-01RIO GRANDE DO NORTE15
622016-02-01RIO GRANDE DO NORTE2
632016-03-01RIO GRANDE DO NORTE1
642016-04-01RIO GRANDE DO NORTE0
652016-05-01RIO GRANDE DO NORTE1
662016-06-01RIO GRANDE DO NORTE4
672016-07-01RIO GRANDE DO NORTE13
682016-08-01RIO GRANDE DO NORTE24
692016-09-01RIO GRANDE DO NORTE44
702016-10-01RIO GRANDE DO NORTE129
712016-11-01RIO GRANDE DO NORTE93
722016-12-01RIO GRANDE DO NORTE75
732016-01-01RIO GRANDE DO SUL68
742016-02-01RIO GRANDE DO SUL55
752016-03-01RIO GRANDE DO SUL30
762016-04-01RIO GRANDE DO SUL32
772016-05-01RIO GRANDE DO SUL37
782016-06-01RIO GRANDE DO SUL261
792016-07-01RIO GRANDE DO SUL865
802016-08-01RIO GRANDE DO SUL1111
812016-09-01RIO GRANDE DO SUL628
822016-10-01RIO GRANDE DO SUL93
832016-11-01RIO GRANDE DO SUL105
842016-12-01RIO GRANDE DO SUL79
852016-01-01RONDÔNIA93
862016-02-01RONDÔNIA88
872016-03-01RONDÔNIA25
882016-04-01RONDÔNIA59
892016-05-01RONDÔNIA44
902016-06-01RONDÔNIA170
912016-07-01RONDÔNIA969
922016-08-01RONDÔNIA3675
932016-09-01RONDÔNIA4208
942016-10-01RONDÔNIA1844
952016-11-01RONDÔNIA401
962016-12-01RONDÔNIA148
972016-01-01RORAIMA1754
982016-02-01RORAIMA171
992016-03-01RORAIMA1081
1002016-04-01RORAIMA126
Rows: 1-100 | Columns: 3

Draw the PACF Plot.

data.pacf(
    column = "number",
    ts = "date",
    by = "state",
    method = "pearson",
    p = 24,
)

For more examples, please look at the Auto-Correlation Plot page of the Chart Gallery. Those ones are related to ACF plots, but the customization stays the same for the PACF plot.

See also

VastFrame.acf() : Computes the autocorrelations.