Skip to content

Commit

Permalink
Merge pull request #20 from DiegoCiccia/main
Browse files Browse the repository at this point in the history
Latest updates from de Chaisemartin and D'Haultfoeuille
  • Loading branch information
asjadnaqvi authored May 17, 2024
2 parents 8835b39 + 9693ae4 commit 29989b0
Show file tree
Hide file tree
Showing 11 changed files with 413 additions and 16 deletions.
Binary file added assets/images/did_multiplegt_dyn_R.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/did_multiplegt_dyn_R_did.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/did_multiplegt_dyn_stata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/did_multiplegt_dyn_stata_ep.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/01_stata.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ nav_order: 2

Packages are sorted in alphabetical order by name. Some package paths have been split across lines but adding spaces to keep table formatting intact. Just make sure they are in one line with spaces removed when copying them in Stata. To install packages from GitHub, get the `github` package: `net install github, from("https://haghish.github.io/github/")`. Documentation of Stata packages is usually done on internal help files. Some packages do have dedicated websites, PDFs, or GitHub repositories that are identified in the website column. Also check the equivalent [R packages](https://asjadnaqvi.github.io/DiD/docs/02_R/) package that also lists dedicated pages.


| Name | Installation | Package by | Reference paper(s) |
| --- | --- | --- | --- |
| bacondecomp | `ssc install bacondecomp, replace` | [Andrew Goodman-Bacon](http://goodman-bacon.com/) [<img width="12px" src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/twitter.svg" />](https://twitter.com/agoodmanbacon) <br> [Thomas Goldring](https://tgoldring.com/) <br> Austin Nichols [<img width="12px" src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/twitter.svg" />](https://twitter.com/AustnNchols) | [Goodman-Bacon (2021)](https://www.sciencedirect.com/science/article/abs/pii/S0304407621001445) |
Expand Down
7 changes: 5 additions & 2 deletions docs/02_R.md

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions docs/code/06_04_did_multiplegt.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ image: "../../../assets/images/DiD.png"
# did_multiplegt (Chaisemartin and D'Haultfœuille 2020, 2021)
{: .no_toc }

## Note
{: .no_toc}

To estimate event-study/dynamic effects, we strongly recommend using the <ins>much faster</ins> [did_multiplegt_dyn](https://asjadnaqvi.github.io/DiD/docs/code/06_16_did_multiplegt_dyn.md) command.

In addition to that, did_multiplegt_dyn offers more options than did_multiplegt, among which:
+ **normalized**: estimation of the normalized dynamic effects (de Chaisemartin & D'Haultfoeuille, 2024);
+ **predict_het**: built-in treatment effect heterogeneity analysis;
+ **design** and **date_first_switch**: post-estimation options to analyze the design and timing of the treatment;
+ **by** and **by_path**: estimating dynamic effects within levels of a group-level variable or within treatment paths;
+ **trends_lin**: built-in group-specific linear trends.

Lastly, as of the last release, did_multiplegt_dyn also includes two user-requested features:
+ **only_never_switchers**: restricting the estimators from de Chaisemartin & D'Haultfoeuille (2024) to only compare switchers and never-switchers;
+ integration with **esttab**: here a quick [tutorial](https://github.com/chaisemartinPackages/did_multiplegt_dyn/blob/main/vignettes/vignette_2.md).

## Table of contents
{: .no_toc .text-delta }

Expand All @@ -18,8 +34,6 @@ image: "../../../assets/images/DiD.png"

---



## Installation and options

```stata
Expand All @@ -32,9 +46,6 @@ Take a look at the help file:
help did_multiplegt
```




## Test the command

Please make sure that you generate the data using the script given [here](https://asjadnaqvi.github.io/DiD/docs/code/06_03_data/)
Expand Down
113 changes: 113 additions & 0 deletions docs/code/06_16_did_multiplegt_dyn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
layout: default
title: did_multiplegt_dyn
parent: Stata code
nav_order: 4
mathjax: true
image: "../../../assets/images/DiD.png"
---

# did_multiplegt_dyn (Chaisemartin and D'Haultfœuille 2024)
{: .no_toc }

## Table of contents
{: .no_toc .text-delta }

1. TOC
{:toc}

---

## Installation and options

```stata
ssc install did_multiplegt_dyn, replace
```

Take a look at the help file:

```stata
help did_multiplegt_dyn
```

## Test the command

Please make sure that you generate the data using the script given [here](https://asjadnaqvi.github.io/DiD/docs/code/06_03_data/)

Let's try the basic `did_multiplegt_dyn` command:


```stata
did_multiplegt_dyn Y id t D, effects(10) placebo(10) cluster(id)
```

and we get this output:

```
--------------------------------------------------------------------------------
Estimation of treatment effects: Event-study effects
--------------------------------------------------------------------------------
| Estimate SE LB CI UB CI N Switchers
-------------+-----------------------------------------------------------------
Effect_1 | -.0608394 .3275515 -.7028286 .5811498 78 23
Effect_2 | 8.49767 .3888474 7.735543 9.259797 78 23
Effect_3 | 17.64773 .3877416 16.88777 18.40769 78 23
Effect_4 | 25.9377 .3203208 25.30988 26.56551 78 23
Effect_5 | 34.62362 .3923778 33.85458 35.39267 75 23
Effect_6 | 42.85682 .3893014 42.09381 43.61984 64 19
Effect_7 | 51.93103 .3963844 51.15413 52.70793 64 19
Effect_8 | 60.13327 .3945513 59.35997 60.90658 64 19
Effect_9 | 68.82446 .4118019 68.01735 69.63158 64 19
Effect_10 | 77.30792 .4396869 76.44615 78.16969 64 19
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Average cumulative (total) effect per treatment unit
--------------------------------------------------------------------------------
| Estimate SE LB CI UB CI N Switch x Periods
-------------+----------------------------------------------------------------------------
Av_tot_eff | 36.72796 .2689364 36.20085 37.25506 641 210
--------------------------------------------------------------------------------
Average number of time periods over which a treatment's effect is accumulated = 5.2619048
--------------------------------------------------------------------------------
Testing the parallel trends and no anticipation assumptions
--------------------------------------------------------------------------------
| Estimate SE LB CI UB CI N Switchers
-------------+-----------------------------------------------------------------
Placebo_1 | .1308918 .4574125 -.7656203 1.027404 78 23
Placebo_2 | -.0635463 .3403349 -.7305904 .6034978 78 23
Placebo_3 | -.1275425 .3855322 -.8831717 .6280867 78 23
Placebo_4 | -.3848303 .3223237 -1.016573 .2469125 78 23
Placebo_5 | -.4583828 .3389718 -1.122755 .2059897 75 23
Placebo_6 | -.187576 .4510044 -1.071528 .6963763 64 19
Placebo_7 | .1194068 .4068627 -.6780295 .9168431 64 19
Placebo_8 | .0628537 .4251272 -.7703804 .8960877 64 19
Placebo_9 | -.1943702 .4963493 -1.167197 .7784565 64 19
Placebo_10 | -.2936846 .5040208 -1.281547 .694178 64 19
--------------------------------------------------------------------------------
Test of joint nullity of the placebos : p-value = .01289977
The development of this package was funded by the European Union (ERC, REALLYCREDIBLE,GA N°101043899).
```

If the **graph_off** option is not specified, the command always returns by default an event-study graph:

<img src="../../../assets/images/did_multiplegt_dyn_stata.png" height="300">

It is also possible to use `event_plot` to produce the event-study graph:

```stata
event_plot e(estimates)#e(variances), default_look ///
graph_opt(xtitle("Periods since the event") ytitle("Average causal effect") ///
title("did_multiplegt_dyn") xlabel(-10(1)10)) stub_lag(Effect_#) stub_lead(Placebo_#) together
```

<img src="../../../assets/images/did_multiplegt_dyn_stata_ep.png" height="300">
Loading

0 comments on commit 29989b0

Please sign in to comment.