durbin_watson¶
In [ ]:
durbin_watson(vdf: vDataFrame,
eps: str,
ts: str,
by: list = [])
Durbin-Watson test (autocorrelation of residuals).
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
vdf | vDataFrame | ❌ | input vDataFrame. |
eps | str | ❌ | Input residual vcolumn. |
ts | str | ❌ | vcolumn used as timeline. It will be to use to order the data. It can be a numerical or type date like (date, datetime, timestamp...) vcolumn. |
by | list | ✓ | vcolumns used in the partition. |
In [2]:
from verticapy import *
texas = vDataFrame("Texas")
texas.plot(ts = "date", columns = ["cases", "deaths"])
Out[2]:
In [3]:
from verticapy.learn.linear_model import LinearRegression
model = LinearRegression("Texas_deaths_lr")
model.drop()
model.fit(texas, X = ["cases"], y = "deaths")
texas = model.predict(texas, name = "deaths_pred")
texas["eps"] = texas["deaths"] - texas["deaths_pred"]
In [5]:
from verticapy.stats import durbin_watson
durbin_watson(texas,
eps = "eps",
ts = "date")
Out[5]:
