Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyFixest 0.10.8: More flexible DID2s support #206

Merged
merged 46 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
abd31d1
initial commit
s3alfisc Oct 21, 2023
fa7dfc3
reproduce did2s.r results
s3alfisc Oct 21, 2023
99ad650
add twfe estimator
s3alfisc Oct 21, 2023
acf761a
create treatment var internally
s3alfisc Oct 22, 2023
258b381
some defensive input checks
s3alfisc Oct 22, 2023
1018f78
acknowledge kyle as copyright holder
s3alfisc Oct 22, 2023
13c49d9
create experimental folder
s3alfisc Oct 22, 2023
9429cf3
update docs
s3alfisc Oct 22, 2023
f03deb3
update version
s3alfisc Oct 22, 2023
250710c
add did2s function
s3alfisc Oct 28, 2023
30e2f90
get event_study() did2s to work again
s3alfisc Oct 29, 2023
65f3e23
delete did2s function
s3alfisc Oct 29, 2023
7e83905
add basic tests
s3alfisc Oct 29, 2023
1a999e7
patch version
s3alfisc Oct 29, 2023
77fd0be
solve merge conflicts
s3alfisc Oct 29, 2023
74e2162
delete pyaches
s3alfisc Oct 29, 2023
b3a93cc
update news
s3alfisc Oct 29, 2023
09da8e1
update starting message
s3alfisc Oct 29, 2023
7031577
update readme
s3alfisc Oct 29, 2023
7398f5e
update pyproject.toml
s3alfisc Oct 30, 2023
3e5d134
ci tests on mac as fixest already compiled
s3alfisc Oct 30, 2023
edd9640
test on windows
s3alfisc Oct 30, 2023
79ad27c
back to testing on linux
s3alfisc Oct 30, 2023
1ec2f7d
first install python, then R deps
s3alfisc Oct 30, 2023
284dcaa
fix yaml syntax
s3alfisc Oct 30, 2023
04e4140
yaml is too hard
s3alfisc Oct 30, 2023
c3126e4
some work towards a more flexible API
s3alfisc Nov 1, 2023
b434eb5
get did2s function prototype to run
s3alfisc Nov 1, 2023
2abae06
event_study() and did2s() both run through
s3alfisc Nov 1, 2023
56cc476
add examples to did2s() and event_study()
s3alfisc Nov 1, 2023
a7e9543
more tests for did2s
s3alfisc Nov 4, 2023
4cebcd0
pass tests
s3alfisc Nov 4, 2023
a517627
two reference levels
s3alfisc Nov 4, 2023
48a173e
fix small bug re _drop_ref
s3alfisc Nov 4, 2023
28b30bb
get did2s() to run
s3alfisc Nov 4, 2023
d320c7f
Merge branch 'master' into did
s3alfisc Nov 4, 2023
eb81717
fix did2s vcov bug
s3alfisc Nov 4, 2023
87e5907
Merge branch 'did' of https://github.com/s3alfisc/pyfixest into did
s3alfisc Nov 4, 2023
bbac5a1
add tests
s3alfisc Nov 5, 2023
63c83eb
update did example
s3alfisc Nov 5, 2023
cbf54b8
further updates
s3alfisc Nov 5, 2023
47d35af
update i-tests
s3alfisc Nov 5, 2023
302413e
bump version and update readme
s3alfisc Nov 5, 2023
efb30ed
readme tweaks
s3alfisc Nov 5, 2023
257aafa
update news
s3alfisc Nov 5, 2023
3d89638
update readme
s3alfisc Nov 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ dist
.pytest_cache
.vscode
*.pyc
__pycache__/
__pycache__/
figures
docs/figures
docs/news_files
readme_files
436 changes: 436 additions & 0 deletions docs/news.html

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions docs/news.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# News

## PyFixest `0.10.8`

### Breaking changes
Reference levels for the `i()` formula syntax can no longer be set within the formula, but need to be added via the `i_ref1` function argument to either `feols()` and `fepois()`.

### New feature

A `dids2()` function is added, which implements the 2-stage difference-in-differences procedure à la Gardner and follows the syntax of @kylebutts [did2s](https://github.com/kylebutts/did2s) R package.

```py
from pyfixest.experimental.did import did2s
from pyfixest.estimation import feols
from pyfixest.visualize import iplot
import pandas as pd
import numpy as np

df_het = pd.read_csv("https://raw.githubusercontent.com/s3alfisc/pyfixest/master/pyfixest/experimental/data/df_het.csv")

fit = did2s(
df_het,
yname = "dep_var",
first_stage = "~ 0 | state + year",
second_stage = "~i(rel_year)",
treatment = "treat",
cluster = "state",
i_ref1 = [-1.0, np.inf],
)

fit_twfe = feols(
"dep_var ~ i(rel_year) | state + year",
df_het,
i_ref1 = [-1.0, np.inf]
)

iplot([fit, fit_twfe], coord_flip=False, figsize = (900, 400), title = "TWFE vs DID2S")
```
![](figures/event_study.svg)



## PyFixest `0.10.7`

- Adds basic support for event study estimation via two-way fixed effects and Gardner's two-stage "Did2s" approach.
Expand Down
Loading
Loading