Files
OpenBB/website/content/sdk/reference/econometrics/ols.md
jose-donato 2e7eb4c9b6 New documentation website (#3526)
* fix(docs): added margin between sections

* feat: removed unused files; updated ga

* fix: juan stuff doesnt work

* fix: random fix

* moon at noon

* fix: update docusaurus config

* Update controller_doc_classes.py

* fix: temp fix

* fix: temp fix

* Update controller_doc_classes.py

* fix: remove old content

* fix: taggfix

* init

* fix: styling and moved file

* Update generate_terminal_markdown.py

* fix: removed unused images

* fix: port new files

* Update generate_sdk_markdown.py

* Update controller_doc_classes.py

Co-authored-by: teh_coderer <me@tehcoderer.com>
2022-11-22 16:47:03 +00:00

3.0 KiB
Vendored

title, description
title description
ols OpenBB SDK Function

ols

Performs an OLS regression on timeseries data. [Source: Statsmodels]

Source Code: [link]

openbb.econometrics.ols(Y: pd.DataFrame, X: pd.DataFrame)

Parameters

Name Type Description Default Optional
Y pd.DataFrame Dependent variable series. None False
X pd.DataFrame Dataframe of independent variables series. None False

Returns

Type Description
statsmodels.regression.linear_model.RegressionResultsWrapper Regression model wrapper from statsmodels.

Examples

SDK Snippet:

import openbb_terminal.sdk as openbb
df = openbb.econometrics.load("wage_panel")
OLS_model = openbb.econometrics.OLS(df["lwage"], df[["educ", "exper", "expersq"]])
print(OLS_model.summary())`

Results:

                             OLS Regression Results
=======================================================================================
Dep. Variable:                  lwage   R-squared (uncentered):                   0.920
Model:                            OLS   Adj. R-squared (uncentered):              0.919
Method:                 Least Squares   F-statistic:                          1.659e+04
Date:                Thu, 10 Nov 2022   Prob (F-statistic):                        0.00
Time:                        15:28:11   Log-Likelihood:                         -3091.3
No. Observations:                4360   AIC:                                      6189.
Df Residuals:                    4357   BIC:                                      6208.
Df Model:                           3
Covariance Type:            nonrobust
==============================================================================
                coef    std err          t      P>|t|      [0.025      0.975]
------------------------------------------------------------------------------
educ           0.0986      0.002     39.879      0.000       0.094       0.103
exper          0.1018      0.009     10.737      0.000       0.083       0.120
expersq       -0.0034      0.001     -4.894      0.000      -0.005      -0.002
==============================================================================
Omnibus:                     1249.642   Durbin-Watson:                   0.954
Prob(Omnibus):                  0.000   Jarque-Bera (JB):             9627.436
Skew:                          -1.152   Prob(JB):                         0.00
Kurtosis:                       9.905   Cond. No.                         86.4
==============================================================================
Notes:
[1] R² is computed without centering (uncentered) since the model does not contain a constant.
[2] Standard Errors assume that the covariance matrix of the errors is correctly specified.