Skip to content

Commit

Permalink
resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
s3alfisc committed Oct 3, 2024
2 parents a0c67cc + 87d12e1 commit 6fc50b4
Show file tree
Hide file tree
Showing 9 changed files with 517 additions and 14 deletions.
1 change: 1 addition & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ quartodoc:
- report.dtable
- report.coefplot
- report.iplot
- did.visualize.panelview
- title: Misc / Utilities
desc: |
PyFixest internals and utilities
Expand Down
1 change: 1 addition & 0 deletions docs/_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ website:
- reference/report.dtable.qmd
- reference/report.coefplot.qmd
- reference/report.iplot.qmd
- reference/did.visualize.panelview.qmd
section: Summarize and Visualize
- contents:
- reference/estimation.demean.qmd
Expand Down
111 changes: 107 additions & 4 deletions docs/difference-in-differences.ipynb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions pyfixest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
report,
utils,
)
from pyfixest.did import did2s, event_study, lpdid, panelview

# Import frequently used functions and classes
from pyfixest.estimation import (
Expand Down Expand Up @@ -41,6 +42,10 @@
"estimation",
"report",
"utils",
"event_study",
"lpdid",
"did2s",
"panelview",
]

from importlib.metadata import PackageNotFoundError, version
Expand Down
15 changes: 15 additions & 0 deletions pyfixest/did/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pyfixest.did.estimation import (
did2s,
event_study,
lpdid,
)
from pyfixest.did.visualize import (
panelview,
)

__all__ = [
"did2s",
"lpdid",
"panelview",
"event_study",
]
16 changes: 8 additions & 8 deletions pyfixest/did/estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def event_study(
--------
```{python}
import pandas as pd
from pyfixest.did.estimation import event_study
import pyfixest as pf
url = "https://raw.githubusercontent.com/py-econometrics/pyfixest/master/pyfixest/did/data/df_het.csv"
df_het = pd.read_csv(url)
fit_twfe = event_study(
fit_twfe = pf.event_study(
df_het,
yname="dep_var",
idname="unit",
Expand Down Expand Up @@ -171,7 +171,7 @@ def did2s(
```{python}
import pandas as pd
import numpy as np
from pyfixest.did.estimation import did2s
import pyfixest as pf
url = "https://raw.githubusercontent.com/py-econometrics/pyfixest/master/pyfixest/did/data/df_het.csv"
df_het = pd.read_csv(url)
Expand All @@ -182,7 +182,7 @@ def did2s(
```{python}
# estimate the model
fit = did2s(
fit = pf.did2s(
df_het,
yname="dep_var",
first_stage="~ 0 | unit + year",
Expand All @@ -203,7 +203,7 @@ def did2s(
To estimate a pooled effect, we need to slightly update the second stage formula:
```{python}
fit = did2s(
fit = pf.did2s(
df_het,
yname="dep_var",
first_stage="~ 0 | unit + year",
Expand Down Expand Up @@ -319,12 +319,12 @@ def lpdid(
--------
```{python}
import pandas as pd
from pyfixest.did.estimation import lpdid
import pyfixest as pf
url = "https://raw.githubusercontent.com/py-econometrics/pyfixest/master/pyfixest/did/data/df_het.csv"
df_het = pd.read_csv(url)
fit = lpdid(
fit = pf.lpdid(
df_het,
yname="dep_var",
idname="unit",
Expand All @@ -343,7 +343,7 @@ def lpdid(
To get the ATT, set `att=True`:
```{python}
fit = lpdid(
fit = pf.lpdid(
df_het,
yname="dep_var",
idname="unit",
Expand Down
Loading

0 comments on commit 6fc50b4

Please sign in to comment.