Files
OpenBB/website/content/sdk/reference/econometrics/panel.md
DidierRLopes 4ad995fdd0 Docs/terminalpro and improvement (#5622)
* add first iteration of content for Terminal Pro

* Update index.md

* Update dashboards.md

* Update folders.md

* Update grouping.md

* Update report.md

* Update templates.md

* Update quick-start.md

* Update index.md

* Update index.md

* Update home.md

* Update news.md

* Update index.md

* Update index.md

* Update index.md

* Update data-provider.md

* Update chat-with-widget.md

* Update data-manipulation.md

* Update forecasting.md

* fix: images self closing tags

* fix: only pro visitors can see pro

* inter font

* improve SEO content and restructuring

* add new package for toggle on tutorials

* move folder around

* improve main page of each prod

* small updates and improvements

* fix logo above

* small improvement in headtitle for portfolio funcs

* fix typos from OpenAI's GPT-4

* fix _category_ json

* remove generic SEO words

* add script that generates SEO for documentation

* add missing file

* remove sdk warning message

* fix links for andrew

---------

Co-authored-by: jose-donato <zmcdonato@gmail.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
2023-10-30 21:01:29 +00:00

141 lines
5.4 KiB
Markdown
Vendored

---
title: panel
description: Tutorial on how to use OpenBB Terminal's econometric functions with focus
on running panel regression models. This includes choosing the type of regression,
setting entity and time effects, and interacting with the Python SDK. Provides examples
using the 'openbb.econometrics.panel' function, which allows selection of OLS or
pooled OLS models, and demonstrates how to read and interpret the model summary.
Also explains the 'openbb.econometrics.panel_chart' function, which visualizes regression
outcomes.
keywords:
- Docusaurus
- Econometrics
- Panel Regression
- Fixed Effects
- Python SDK
- OLS Regression
- Regression Model
- Pooled OLS
- Regression Chart
---
import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
<HeadTitle title="econometrics.panel - Reference | OpenBB SDK Docs" />
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs>
<TabItem value="model" label="Model" default>
Based on the regression type, this function decides what regression to run.
Source Code: [[link](https://github.com/OpenBB-finance/OpenBBTerminal/tree/main/openbb_terminal/econometrics/regression_model.py#L34)]
```python
openbb.econometrics.panel(Y: pd.DataFrame, X: pd.DataFrame, regression_type: str = "OLS", entity_effects: bool = False, time_effects: bool = False)
```
---
## Parameters
| Name | Type | Description | Default | Optional |
| ---- | ---- | ----------- | ------- | -------- |
| Y | pd.DataFrame | Dataframe containing the dependent variable. | None | False |
| X | pd.DataFrame | Dataframe containing the independent variables. | None | False |
| regression_type | str | The type of regression you wish to execute. | OLS | True |
| entity_effects | bool | Whether to apply Fixed Effects on entities. | False | True |
| time_effects | bool | Whether to apply Fixed Effects on time. | False | True |
---
## Returns
| Type | Description |
| ---- | ----------- |
| Any | A regression model |
---
## Examples
```python
from openbb_terminal.sdk import openbb
df = openbb.econometrics.load("wage_panel")
df = df.set_index(["nr","year"])
X = df[["exper","educ","union"]]
Y = df["lwage"]
pooled_ols_model = openbb.econometrics.panel(Y,X,"POLS")
print(pooled_ols_model.summary)
```
```
PooledOLS Estimation Summary
================================================================================
Dep. Variable: lwage R-squared: 0.1634
Estimator: PooledOLS R-squared (Between): 0.1686
No. Observations: 4360 R-squared (Within): 0.1575
Date: Sun, Nov 13 2022 R-squared (Overall): 0.1634
Time: 13:04:02 Log-likelihood -3050.4
Cov. Estimator: Unadjusted
F-statistic: 283.68
Entities: 545 P-value 0.0000
Avg Obs: 8.0000 Distribution: F(3,4356)
Min Obs: 8.0000
Max Obs: 8.0000 F-statistic (robust): 283.68
P-value 0.0000
Time periods: 8 Distribution: F(3,4356)
Avg Obs: 545.00
Min Obs: 545.00
Max Obs: 545.00
Parameter Estimates
==============================================================================
Parameter Std. Err. T-stat P-value Lower CI Upper CI
------------------------------------------------------------------------------
const -0.0308 0.0620 -0.4965 0.6196 -0.1523 0.0908
exper 0.0561 0.0028 20.220 0.0000 0.0507 0.0616
educ 0.1080 0.0045 24.034 0.0000 0.0992 0.1168
union 0.1777 0.0172 10.344 0.0000 0.1441 0.2114
==============================================================================
```
---
</TabItem>
<TabItem value="view" label="Chart">
Based on the regression type, this function decides what regression to run.
Source Code: [[link](https://github.com/OpenBB-finance/OpenBBTerminal/tree/main/openbb_terminal/econometrics/regression_view.py#L23)]
```python
openbb.econometrics.panel_chart(Y: pd.DataFrame, X: pd.DataFrame, regression_type: str = "OLS", entity_effects: bool = False, time_effects: bool = False, export: str = "")
```
---
## Parameters
| Name | Type | Description | Default | Optional |
| ---- | ---- | ----------- | ------- | -------- |
| data | dict | A dictionary containing the datasets. | None | True |
| regression_variables | list | The regressions variables entered where the first variable is<br/>the dependent variable.<br/>each column/dataset combination. | None | True |
| regression_type | str | The type of regression you wish to execute. Choose from:<br/>OLS, POLS, RE, BOLS, FE | OLS | True |
| entity_effects | bool | Whether to apply Fixed Effects on entities. | False | True |
| time_effects | bool | Whether to apply Fixed Effects on time. | False | True |
| export | str | Format to export data | | True |
---
## Returns
| Type | Description |
| ---- | ----------- |
| The dataset used, the dependent variable, the independent variable and | |
---
</TabItem>
</Tabs>