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()
📅dateDateAbcstateVarchar(32)123numberInteger1 2016-01-01 PARAÍBA 18 2 2016-02-01 PARAÍBA 4 3 2016-03-01 PARAÍBA 1 4 2016-04-01 PARAÍBA 1 5 2016-05-01 PARAÍBA 1 6 2016-06-01 PARAÍBA 4 7 2016-07-01 PARAÍBA 22 8 2016-08-01 PARAÍBA 50 9 2016-09-01 PARAÍBA 131 10 2016-10-01 PARAÍBA 304 11 2016-11-01 PARAÍBA 132 12 2016-12-01 PARAÍBA 8 13 2016-01-01 PARÁ 1322 14 2016-02-01 PARÁ 430 15 2016-03-01 PARÁ 81 16 2016-04-01 PARÁ 66 17 2016-05-01 PARÁ 154 18 2016-06-01 PARÁ 502 19 2016-07-01 PARÁ 1579 20 2016-08-01 PARÁ 4863 21 2016-09-01 PARÁ 3953 22 2016-10-01 PARÁ 5281 23 2016-11-01 PARÁ 7879 24 2016-12-01 PARÁ 3300 25 2016-01-01 PERNAMBUCO 24 26 2016-02-01 PERNAMBUCO 19 27 2016-03-01 PERNAMBUCO 4 28 2016-04-01 PERNAMBUCO 8 29 2016-05-01 PERNAMBUCO 6 30 2016-06-01 PERNAMBUCO 4 31 2016-07-01 PERNAMBUCO 17 32 2016-08-01 PERNAMBUCO 42 33 2016-09-01 PERNAMBUCO 171 34 2016-10-01 PERNAMBUCO 319 35 2016-11-01 PERNAMBUCO 191 36 2016-12-01 PERNAMBUCO 161 37 2016-01-01 PIAUÍ 94 38 2016-02-01 PIAUÍ 97 39 2016-03-01 PIAUÍ 53 40 2016-04-01 PIAUÍ 35 41 2016-05-01 PIAUÍ 60 42 2016-06-01 PIAUÍ 153 43 2016-07-01 PIAUÍ 754 44 2016-08-01 PIAUÍ 1647 45 2016-09-01 PIAUÍ 1394 46 2016-10-01 PIAUÍ 2598 47 2016-11-01 PIAUÍ 1126 48 2016-12-01 PIAUÍ 374 49 2016-01-01 RIO DE JANEIRO 9 50 2016-02-01 RIO DE JANEIRO 16 51 2016-03-01 RIO DE JANEIRO 16 52 2016-04-01 RIO DE JANEIRO 45 53 2016-05-01 RIO DE JANEIRO 30 54 2016-06-01 RIO DE JANEIRO 37 55 2016-07-01 RIO DE JANEIRO 131 56 2016-08-01 RIO DE JANEIRO 241 57 2016-09-01 RIO DE JANEIRO 195 58 2016-10-01 RIO DE JANEIRO 30 59 2016-11-01 RIO DE JANEIRO 19 60 2016-12-01 RIO DE JANEIRO 5 61 2016-01-01 RIO GRANDE DO NORTE 15 62 2016-02-01 RIO GRANDE DO NORTE 2 63 2016-03-01 RIO GRANDE DO NORTE 1 64 2016-04-01 RIO GRANDE DO NORTE 0 65 2016-05-01 RIO GRANDE DO NORTE 1 66 2016-06-01 RIO GRANDE DO NORTE 4 67 2016-07-01 RIO GRANDE DO NORTE 13 68 2016-08-01 RIO GRANDE DO NORTE 24 69 2016-09-01 RIO GRANDE DO NORTE 44 70 2016-10-01 RIO GRANDE DO NORTE 129 71 2016-11-01 RIO GRANDE DO NORTE 93 72 2016-12-01 RIO GRANDE DO NORTE 75 73 2016-01-01 RIO GRANDE DO SUL 68 74 2016-02-01 RIO GRANDE DO SUL 55 75 2016-03-01 RIO GRANDE DO SUL 30 76 2016-04-01 RIO GRANDE DO SUL 32 77 2016-05-01 RIO GRANDE DO SUL 37 78 2016-06-01 RIO GRANDE DO SUL 261 79 2016-07-01 RIO GRANDE DO SUL 865 80 2016-08-01 RIO GRANDE DO SUL 1111 81 2016-09-01 RIO GRANDE DO SUL 628 82 2016-10-01 RIO GRANDE DO SUL 93 83 2016-11-01 RIO GRANDE DO SUL 105 84 2016-12-01 RIO GRANDE DO SUL 79 85 2016-01-01 RONDÔNIA 93 86 2016-02-01 RONDÔNIA 88 87 2016-03-01 RONDÔNIA 25 88 2016-04-01 RONDÔNIA 59 89 2016-05-01 RONDÔNIA 44 90 2016-06-01 RONDÔNIA 170 91 2016-07-01 RONDÔNIA 969 92 2016-08-01 RONDÔNIA 3675 93 2016-09-01 RONDÔNIA 4208 94 2016-10-01 RONDÔNIA 1844 95 2016-11-01 RONDÔNIA 401 96 2016-12-01 RONDÔNIA 148 97 2016-01-01 RORAIMA 1754 98 2016-02-01 RORAIMA 171 99 2016-03-01 RORAIMA 1081 100 2016-04-01 RORAIMA 126 Rows: 1-100 | Columns: 3Draw 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.