vDataFrame.pacf

In [ ]:
vDataFrame.pacf(column: str,
                ts: str,
                by: list = [],
                p=12,
                unit: str = "rows",
                confidence: bool = True,
                alpha: float = 0.95,
                show: bool = True,
                ax = None,
                **style_kwds,)

Computes the partial autocorrelations of the input vcolumn.

Parameters

Name Type Optional Description
ts
str
A time series vcolumn (date or numerical type) used to order the data.
column
str
Input vcolumn to use to compute the Auto Correlation Plot.
by
list
vcolumns used in the partition.
p
int / list
Either the maximum number of lag to consider during the computation (positive int) or a list of the different lags to include in the computation (list of positive integers).
unit
str
Unit to use 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.
confidence
bool
If set to True, the confidence band width is drawn.
alpha
float
Significance Level. Probability to accept H0. Only used to compute the confidence band width.
show
bool
If True, the plot will be drawn using Matplotlib.
ax
Matplotlib axes object
The axes to plot on.
**style_kwds
any
Any optional parameter to pass to the Matplotlib functions.

Returns

tablesample : An object containing the result. For more information, see utilities.tablesample.

Example

In [16]:
from verticapy.datasets import load_amazon
amazon = load_amazon()
display(amazon)
📅
date
Date
Abc
state
Varchar(32)
123
number
Int
11998-01-01ACRE0
21998-01-01ALAGOAS0
31998-01-01AMAPÁ0
41998-01-01AMAZONAS0
51998-01-01BAHIA0
61998-01-01CEARÁ0
71998-01-01DISTRITO FEDERAL0
81998-01-01ESPÍRITO SANTO0
91998-01-01GOIÁS0
101998-01-01MARANHÃO0
111998-01-01MATO GROSSO0
121998-01-01MATO GROSSO DO SUL0
131998-01-01MINAS GERAIS0
141998-01-01PARANÁ0
151998-01-01PARAÍBA0
161998-01-01PARÁ0
171998-01-01PERNAMBUCO0
181998-01-01PIAUÍ0
191998-01-01RIO DE JANEIRO0
201998-01-01RIO GRANDE DO NORTE0
211998-01-01RIO GRANDE DO SUL0
221998-01-01RONDÔNIA0
231998-01-01RORAIMA0
241998-01-01SANTA CATARINA0
251998-01-01SERGIPE0
261998-01-01SÃO PAULO0
271998-01-01TOCANTINS0
281998-02-01ACRE0
291998-02-01ALAGOAS0
301998-02-01AMAPÁ0
311998-02-01AMAZONAS0
321998-02-01BAHIA0
331998-02-01CEARÁ0
341998-02-01DISTRITO FEDERAL0
351998-02-01ESPÍRITO SANTO0
361998-02-01GOIÁS0
371998-02-01MARANHÃO0
381998-02-01MATO GROSSO0
391998-02-01MATO GROSSO DO SUL0
401998-02-01MINAS GERAIS0
411998-02-01PARANÁ0
421998-02-01PARAÍBA0
431998-02-01PARÁ0
441998-02-01PERNAMBUCO0
451998-02-01PIAUÍ0
461998-02-01RIO DE JANEIRO0
471998-02-01RIO GRANDE DO NORTE0
481998-02-01RIO GRANDE DO SUL0
491998-02-01RONDÔNIA0
501998-02-01RORAIMA0
511998-02-01SANTA CATARINA0
521998-02-01SERGIPE0
531998-02-01SÃO PAULO0
541998-02-01TOCANTINS0
551998-03-01ACRE0
561998-03-01ALAGOAS0
571998-03-01AMAPÁ0
581998-03-01AMAZONAS0
591998-03-01BAHIA0
601998-03-01CEARÁ0
611998-03-01DISTRITO FEDERAL0
621998-03-01ESPÍRITO SANTO0
631998-03-01GOIÁS0
641998-03-01MARANHÃO0
651998-03-01MATO GROSSO0
661998-03-01MATO GROSSO DO SUL0
671998-03-01MINAS GERAIS0
681998-03-01PARANÁ0
691998-03-01PARAÍBA0
701998-03-01PARÁ0
711998-03-01PERNAMBUCO0
721998-03-01PIAUÍ0
731998-03-01RIO DE JANEIRO0
741998-03-01RIO GRANDE DO NORTE0
751998-03-01RIO GRANDE DO SUL0
761998-03-01RONDÔNIA0
771998-03-01RORAIMA0
781998-03-01SANTA CATARINA0
791998-03-01SERGIPE0
801998-03-01SÃO PAULO0
811998-03-01TOCANTINS0
821998-04-01ACRE0
831998-04-01ALAGOAS0
841998-04-01AMAPÁ0
851998-04-01AMAZONAS0
861998-04-01BAHIA0
871998-04-01CEARÁ0
881998-04-01DISTRITO FEDERAL0
891998-04-01ESPÍRITO SANTO0
901998-04-01GOIÁS0
911998-04-01MARANHÃO0
921998-04-01MATO GROSSO0
931998-04-01MATO GROSSO DO SUL0
941998-04-01MINAS GERAIS0
951998-04-01PARANÁ0
961998-04-01PARAÍBA0
971998-04-01PARÁ0
981998-04-01PERNAMBUCO0
991998-04-01PIAUÍ0
1001998-04-01RIO DE JANEIRO0
Rows: 1-100 | Columns: 3
In [17]:
# Partial Autocorrelation Plot for each 'month' lag
# p = 48: it will compute 48 'months' lags
amazon.pacf(ts = "date", 
            column = "number", 
            p = 48,
            by = ["state"],
            unit = "month")
Out[17]:
value
confidence
01.00.024396841824873748
10.7519434011479620.03561577920085401
2-0.3306302466496170.03740123196527105
30.06607864051102710.03747358016816702
4-0.08775421222413040.037598666691328594
50.002474191316374230.03760167863147811
60.003904723572846180.03760483583269254
70.03235485597204120.03762433446337734
80.1132000138414340.03782966176322886
90.1655588356448550.03826198873324272
100.263402625735230.0393309932207076
110.4368349588602340.042127366586962825
120.3990898641523070.04432768673622492
13-0.2303262599526510.0450391818983646
140.008858014399771790.0450437176851836
15-0.03419156458248840.045062695353479516
160.01754353725196460.04507026978640173
17-0.01695076585607460.04507757460115683
180.01059290973988070.045082562077172615
190.001811465551737690.04508610830721674
200.01379681712600790.04509213239577946
210.07256126199173860.045165303260065535
220.1216537601110670.045364079292018286
230.2553002590730920.0462178115199157
240.2045445917012520.046759055131954184
25-0.09410909349077590.046875721085035425
26-0.08618197739868120.04697395461828774
270.04512673985902620.04700351160774375
28-0.02394634425820670.04701446058021534
29-0.0101328120140090.047019424755553374
300.008065007565777230.04702391143385374
31-0.01680967911015480.04703116529904154
320.01193514440096470.04703663844162875
330.01683620050754370.047043905932522966
340.03431439593893180.047062542602361104
350.1439735347145950.047329037779824085
360.1715218315867860.047703300609601124
370.03619316148516630.047723452049141746
38-0.07471542982341910.047797150118625314
390.01933767665752980.047805559762077544
400.01555493112340210.047812317214445565
41-0.05290356709148430.04785109354666675
420.01973551286504750.04785970063627545
43-0.0272245395290360.04787271092612343
44-0.0108621925261510.04787792187907807
45-0.03889289241703410.047900588720196084
46-0.03172925602699950.04791692297627169
47-0.05562295322456880.04795935694502657
48-0.05336219036906160.04799868849319452
Rows: 1-49 | Columns: 3
In [18]:
# Partial Autocorrelation Plot using only the selected lags
amazon.pacf(ts = "date", 
            column = "number", 
            by = ["state"],
            p = [1, 3, 6, 7],
            unit = "year")
Out[18]:
value
confidence
10.6161794055506880.024396841824873748
30.00119604163485210.024398767003202322
60.1476118427140510.024926658917010142
70.01823948106212480.024936536450197444
Rows: 1-4 | Columns: 3

See Also

vDataFrame.acf Computes the Correlations between a vcolumn and its lags.
vDataFrame.corr Computes the Correlation Matrix of a vDataFrame.
vDataFrame.cov Computes the Covariance Matrix of the vDataFrame.
vDataFrame.interpolate Interpolates and computes a regular time interval vDataFrame.