vDataFrame.regr

In [ ]:
vDataFrame.regr(columns: list = [],
                method: str = "r2",
                show: bool = True,
                ax=None,
                **style_kwds,)

Computes the Regression Matrix of the vDataFrame.

Parameters

Name Type Optional Description
columns
list
List of the vcolumns names. If empty, all the numerical vcolumns will be used.
method
str
Method to use to compute the regression matrix.
  • avgx : Average of the independent expression in an expression pair.
  • avgy : Average of the dependent expression in an expression pair.
  • count : Count of all rows in an expression pair.
  • cramer : Cramer's V (correlation between categories).
  • alpha : Intercept of the regression line determined by a set of expression pairs.
  • r2 : Square of the correlation coefficient of a set of expression pairs.
  • beta : Slope of the regression line, determined by a set of expression pairs.
  • sxx : Sum of squares of the independent expression in an expression pair.
  • sxy : Sum of products of the independent expression multiplied by the dependent expression in an expression pair.
  • syy : Returns the sum of squares of the dependent expression in an expression pair.
show
bool
If set to True, the Regression Matrix 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 [5]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
display(titanic)
123
pclass
Int
123
survived
Int
Abc
Varchar(96)
Abc
gender
Char(1)
123
age
Numeric(6,3)
123
sibsp
Int
123
parch
Int
Abc
ticket
Varchar(24)
123
fare
Numeric(7,4)
Abc
cabin
Char(10)
Abc
embarked
Char(1)
Abc
boat
Char(4)
123
body
Int
Abc
homedest
Varchar(64)
123
split
Float
110f2.00012113781151.5500C22 C26 S[null][null]Montreal, PQ / Chesterville, ON0.663092836970463
210m30.00012113781151.5500C22 C26 S[null]135Montreal, PQ / Chesterville, ON0.161721162730828
310f25.00012113781151.5500C22 C26 S[null][null]Montreal, PQ / Chesterville, ON0.527904006186873
410m39.000001120500.0000A36 S[null][null]Belfast, NI0.936014187755063
510m71.00000PC 1760949.5042[null]C[null]22Montevideo, Uruguay0.40874306159094
610m47.00010PC 17757227.5250C62 C64 C[null]124New York, NY0.0771260927431285
710m[null]00PC 1731825.9250[null]S[null][null]New York, NY0.360885151894763
810m24.00001PC 17558247.5208B58 B60 C[null][null]Montreal, PQ0.78418595273979
910m36.000001305075.2417C6 CA [null]Winnipeg, MN0.392075354699045
1010m25.000001390526.0000[null]C[null]148San Francisco, CA0.760954634286463
1110m45.0000011378435.5000T S[null][null]Trenton, NJ0.083728444064036
1210m42.0000011048926.5500D22 S[null][null]London / Winnipeg, MB0.187408909434453
1310m41.0000011305430.5000A21 S[null][null]Pomeroy, WA0.464197367895395
1410m48.00000PC 1759150.4958B10 C[null]208Omaha, NE0.989756429567933
1510m[null]0011237939.6000[null]C[null][null]Philadelphia, PA0.197682256577536
1610m45.0000011305026.5500B38 S[null][null]Washington, DC0.567665293579921
1710m[null]0011379831.0000[null]S[null][null][null]0.221641422947869
1810m33.000006955.0000B51 B53 B5S[null][null]New York, NY0.738475721329451
1910m28.0000011305947.1000[null]S[null][null]Montevideo, Uruguay0.366747971624136
2010m17.0000011305947.1000[null]S[null][null]Montevideo, Uruguay0.268853009678423
2110m49.000001992426.0000[null]S[null][null]Ascot, Berkshire / Rochester, NY0.513710137922317
2210m36.000101987778.8500C46 S[null]172Little Onn Hall, Staffs0.453328180825338
2310m46.00010W.E.P. 573461.1750E31 S[null][null]Amenia, ND0.169697929639369
2410m[null]001120510.0000[null]S[null][null]Liverpool, England / Belfast0.0851756541524082
2510m27.0001013508136.7792C89 C[null][null]Los Angeles, CA0.0152691958937794
2610m[null]0011046552.0000A14 S[null][null]Stoughton, MA0.916533817071468
2710m47.00000572725.5875E58 S[null][null]Victoria, BC0.568090511020273
2810m37.00011PC 1775683.1583E52 C[null][null]Lakewood, NJ0.627309911651537
2910m[null]0011379126.5500[null]S[null][null]Roachdale, IN0.747528738109395
3010m70.00011WE/P 573571.0000B22 S[null]269Milwaukee, WI0.335725951706991
3110m39.00010PC 1759971.2833C85 C[null][null]New York, NY0.481107967440039
3210m31.00010F.C. 1275052.0000B71 S[null][null]Montreal, PQ0.0527018732391298
3310m50.00010PC 17761106.4250C86 C[null]62Deephaven, MN / Cedar Rapids, IA0.97885028552264
3410m39.00000PC 1758029.7000A18 C[null]133Philadelphia, PA0.157812902005389
3510f36.00000PC 1753131.6792A29 C[null][null]New York, NY0.644055349286646
3610m[null]00PC 17483221.7792C95 S[null][null][null]0.279342690482736
3710m30.0000011305127.7500C111 C[null][null]New York, NY0.767035169992596
3810m19.0003219950263.0000C23 C25 C2S[null][null]Winnipeg, MB0.490231013158336
3910m64.0001419950263.0000C23 C25 C2S[null][null]Winnipeg, MB0.235716909635812
4010m[null]0011377826.5500D34 S[null][null]Westcliff-on-Sea, Essex0.390792083926499
4110m[null]001120580.0000B102 S[null][null][null]0.71977791050449
4210m37.0001011380353.1000C123 S[null][null]Scituate, MA0.114295000443235
4310m47.0000011132038.5000E63 S[null]275St Anne's-on-Sea, Lancashire0.831041638739407
4410m24.00000PC 1759379.2000B86 C[null][null][null]0.967385483207181
4510m71.00000PC 1775434.6542A5 C[null][null]New York, NY0.591355679091066
4610m38.00001PC 17582153.4625C91 S[null]147Winnipeg, MB0.870173128321767
4710m46.00000PC 1759379.2000B82 B84 C[null][null]New York, NY0.99003749457188
4810m[null]0011379642.4000[null]S[null][null][null]0.403090257197618
4910m45.000103697383.4750C83 S[null][null]New York, NY0.323395622661337
5010m40.000001120590.0000B94 S[null]110[null]0.170912061352283
5110m55.000111274993.5000B69 S[null]307Montreal, PQ0.737730374792591
5210m42.0000011303842.5000B11 S[null][null]London / Middlesex0.356435600901023
5310m[null]001746351.8625E46 S[null][null]Brighton, MA0.61207019072026
5410m55.0000068050.0000C39 S[null][null]London / Birmingham0.96926672779955
5510m42.0001011378952.0000[null]S[null]38New York, NY0.536786375567317
5610m[null]00PC 1760030.6958[null]C14 [null]New York, NY0.56807480356656
5710f50.00000PC 1759528.7125C49 C[null][null]Paris, France New York, NY0.809493057662621
5810m46.0000069426.0000[null]S[null]80Bennington, VT0.982430178439245
5910m50.0000011304426.0000E60 S[null][null]London0.696268314495683
6010m32.50000113503211.5000C132 C[null]45[null]0.267956059193239
6110m58.000001177129.7000B37 C[null]258Buffalo, NY0.533579262206331
6210m41.000101746451.8625D21 S[null][null]Southington / Noank, CT0.596509403316304
6310m[null]0011302826.5500C124 S[null][null]Portland, OR0.430671361740679
6410m[null]00PC 1761227.7208[null]C[null][null]Chicago, IL0.355260608484969
6510m29.0000011350130.0000D6 S[null]126Springfield, MA0.0263086690101773
6610m30.0000011380145.5000[null]S[null][null]London / New York, NY0.309636837337166
6710m30.0000011046926.0000C106 S[null][null]Brockton, MA0.0152337534818798
6810m19.0001011377353.1000D30 S[null][null]New York, NY0.364044237649068
6910m46.000001305075.2417C6 C[null]292Vancouver, BC0.475262716412544
7010m54.000001746351.8625E46 S[null]175Dorchester, MA0.30979929654859
7110m28.00010PC 1760482.1708[null]C[null][null]New York, NY0.408943912014365
7210m65.000001350926.5500E38 S[null]249East Bridgewater, MA0.478623170405626
7310m44.000201992890.0000C78 Q[null]230Fond du Lac, WI0.148798908572644
7410m55.0000011378730.5000C30 S[null][null]Montreal, PQ0.126385363517329
7510m47.0000011379642.4000[null]S[null][null]Washington, DC0.625826764851809
7610m37.00001PC 1759629.7000C118 C[null][null]Brooklyn, NY0.980584268225357
7710m58.0000235273113.2750D48 C[null]122Lexington, MA0.496911391615868
7810m64.0000069326.0000[null]S[null]263Isle of Wight, England0.189228599891067
7910m65.0000111350961.9792B30 C[null]234Providence, RI0.280916610732675
8010m28.50000PC 1756227.7208D43 C[null]189?Havana, Cuba0.485971889225766
8110m[null]001120520.0000[null]S[null][null]Belfast0.392282282235101
8210m45.5000011304328.5000C124 S[null]166Surbiton Hill, Surrey0.0708799788262695
8310m23.000001274993.5000B24 S[null][null]Montreal, PQ0.089022418949753
8410m29.0001011377666.6000C2 S[null][null]Isleworth, England0.545445928815752
8510m18.00010PC 17758108.9000C65 C[null][null]Madrid, Spain0.513165891636163
8610m47.0000011046552.0000C110 S[null]207Worcester, MA0.164120414061472
8710m38.00000199720.0000[null]S[null][null]Rotterdam, Netherlands0.431144091999158
8810m22.00000PC 17760135.6333[null]C[null]232[null]0.174215304432437
8910m[null]00PC 17757227.5250[null]C[null][null][null]0.641582700423896
9010m31.00000PC 1759050.4958A24 S[null][null]Trenton, NJ0.814205173403025
9110m[null]0011376750.0000A32 S[null][null]Seattle, WA0.195884848246351
9210m36.000001304940.1250A10 C[null][null]Winnipeg, MB0.653516355436295
9310m55.00010PC 1760359.4000[null]C[null][null]New York, NY0.10073209204711
9410m33.0000011379026.5500[null]S[null]109London0.278607521904632
9510m61.00013PC 17608262.3750B57 B59 B6C[null][null]Haverford, PA / Cooperstown, NY0.0629091840237379
9610m50.000101350755.9000E44 S[null][null]Duluth, MN0.963238372234628
9710m56.0000011379226.5500[null]S[null][null]New York, NY0.462777572218329
9810m56.000001776430.6958A7 C[null][null]St James, Long Island, NY0.0639691490214318
9910m24.000101369560.0000C31 S[null][null]Huntington, WV0.0569538441486657
10010m[null]0011305626.0000A19 S[null][null]Streatham, Surrey0.725290278671309
Rows: 1-100 | Columns: 15
In [6]:
# Slope
titanic.regr(method = "beta")
In [3]:
# Intercept
titanic.regr(method = "alpha")

See Also

vDataFrame.acf Computes the Correlations between a vcolumn and its lags.
vDataFrame.corr Computes the Correlation Matrix of the vDataFrame.
vDataFrame.cov Computes the Covariance Matrix of the vDataFrame.