cochrane_orcutt¶
In [ ]:
cochrane_orcutt(model,
vdf: (vDataFrame, str),
ts: str,
prais_winsten: bool = False,
drop_tmp_model: bool = True,)
Performs a Cochrane-Orcutt estimation.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
model | vModel | ❌ | Linear regression object. |
vdf | vDataFrame / str | ❌ | Input relation. |
ts | str | ❌ | vcolumn of numeric or date-like type (date, datetime, timestamp, etc.) used as the timeline and to order the data. |
prais_winsten | bool | ✓ | If true, retains the first observation of the time series, increasing precision and efficiency. This configuration is called the Prais–Winsten estimation. |
drop_tmp_model | bool | ✓ | If true, it drops the temporary model. |
In [15]:
from verticapy.datasets import load_amazon
amazon = load_amazon().search("state = 'ACRE'")
amazon["number_bias"] = "POWER(number, 2) - 500 + RANDOM() * 1000"
from verticapy.learn.linear_model import LinearRegression
model = LinearRegression("model_lr")
model.drop()
model.fit(amazon, ["number_bias"], "number")
model.coef_
Out[15]:
In [17]:
from verticapy.stats import cochrane_orcutt
co = cochrane_orcutt(model, amazon, "date")
co.coef_
Out[17]:
In [18]:
co.pho_
Out[18]:
