Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from friosavila/rc0.1
Browse files Browse the repository at this point in the history
v0.1 ready for release
  • Loading branch information
korenmiklos committed May 18, 2021
2 parents defeb1a + 72bc36b commit 5ddbe9a
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 1,591 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
### Doubly Robust Difference-in-Difference (DRDID) from [Sant'Anna and Zhao (2020)](https://www.sciencedirect.com/science/article/abs/pii/S0304407620301901)
# DRDID: Doubly Robust Difference-in-Differences Estimators for Stata
## Version 0.1 (2021-05-17)
This version is a beta release. If you find an error, please [submit an issue](https://github.com/friosavila/csdid_drdid/issues/new/choose).
# Installation
```
net install drdid, from ("https://raw.githubusercontent.com/friosavila/csdid_drdid/v0.1/code")
```

In order to install the package type the following in Stata:
> net d drdid, from("https://raw.githubusercontent.com/friosavila/csdid_drdid/main/code")
# Authors
- Fernando Rios-Avila (Levy Economics Institute of Bard College), *maintainer*
- Asjad Naqvi (International Institute for Applied Systems Analysis)
# License and Citation
You are free to use this package under the terms of its [license](LICENSE). If you use it, please cite *both* the original article and the software package in your work:

- Sant’Anna, Pedro H. C., and Jun Zhao. 2020a. “Doubly Robust Difference-in-Differences Estimators.” *Journal of Econometrics* 219 (1): 101–22. https://www.sciencedirect.com/science/article/abs/pii/S0304407620301901
- Rios-Avila, Fernando and Asjad Naqvi. 2021. “DRDID: Doubly Robust Difference-in-Differences Estimators for Stata.” [Software] Available at https://github.com/friosavila/csdid_drdid/tree/v0.1

15 changes: 5 additions & 10 deletions code/drdid.pkg
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
v 3

d DRDID: Doubly Robust Difference-in-Differences Estimators
d DRDID: Doubly Robust Difference-in-Differences Estimators (version 0.1)
d
d Authors:
d Support:
d Authors: Fernando Rios-Avila (maintainer), Asjad Naqvi and Pedro H. C. Sant'Anna
d Support: https://github.com/friosavila/csdid_drdid/tree/v0.1
d
d drdid implements the locally efficient doubly robust difference-in-differences (DiD) estimators
d for the average treatment effect proposed by Sant'Anna and Zhao (2020)
Expand All @@ -12,21 +12,17 @@ d outcome regression estimators (also implemented in the package) to form estima
d attractive statistical properties. Two different estimation methods can be used to estimate
d the nuisance functions.
d
d For details (user guide, help, FAQ), see the website:
d https://github.com/friosavila/csdid_drdid
d
d KW: treatment effects
d KW: difference in differences
d KW: att
d
d Requires: Stata version ??
d Requires: Stata version 14
d
d Distribution-Date: 20210511
d Distribution-Date: 20210518
d

f drdid.ado
f drdid_logit.ado
f drdid_rc.ado

f example.do
f test.do
Expand All @@ -35,4 +31,3 @@ f ../data/mpdta.dta
f ../LICENSE

f drdid.sthlp

80 changes: 48 additions & 32 deletions code/drdid.sthlp
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,87 @@
{marker syntax}{...}
{title:Syntax}

{p 8 15 2} {cmd:csdid} {depvar} [{indepvars}] {ifin} {cmd:,} {opth ivar(varname)} {opth time(varname)} {opth treatment(varname)}{p_end}
{text}{phang2}{cmd:drdid} {it:depvar} [{it:indepvars}] [{it:if}] [{it:in}] , [{bf:ivar}({it:varname})] {bf:time}({it:varname}) {bf:treatment}({it:varname}) [{bf:noisily} {it:method} {it:rc1}]{p_end}


{pstd}{cmd:drdid} implements the locally efficient doubly robust difference-in-differences (DiD) estimators for the average treatment effect proposed by Sant'Anna and Zhao (2020). The estimator combines inverse probability weighting and outcome regression estimators (also implemented in the package) to form estimators with more attractive statistical properties.{p_end}


{marker options}{...}
{title:Options}


{marker parameters}{...}
{dlgtab:Parameters}

{synoptset tabbed}{...}
{synopthdr:Option}
{synopthdr:Parameter}
{synoptline}
{synopt:{bf:ivar}}Variable indexing groups, e.g., {it:country}{p_end}
{synopt:{bf:ivar}}Variable indexing groups, e.g., {it:country}. When {bf:ivar} is ignored, repeated cross section data is assumed.{p_end}
{synopt:{bf:time}}Variable indexing time, e.g., {it:year}{p_end}
{synopt:{bf:treatment}}Dummy variable indicating treatment, e.g., {it:reform}{p_end}
{synoptline}


{marker models}{...}
{title:Models}

{marker methods}{...}
{dlgtab:Methods}

{marker dr-did-with-ipt-and-wls}{...}
{dlgtab:DR DiD with IPT and WLS}

{pstd}Sant’Anna and Zhao (2020a) Improved doubly robust DiD estimator based on inverse probability of tilting and weighted least squares{p_end}
{pstd}{it:method} is one of{p_end}

{synoptset tabbed}{...}
{synopthdr:Method}
{synoptline}
{synopt:{bf:drimp} (default)}Sant’Anna and Zhao (2020a) Improved doubly robust DiD estimator based on inverse probability of tilting and weighted least squares{p_end}
{synopt:{bf:dripw}}Sant’Anna and Zhao (2020a) doubly robust DiD estimator based on stabilized inverse probability weighting and ordinary least squares{p_end}
{synopt:{bf:reg}}Outcome regression DiD estimator based on ordinary least squares{p_end}
{synopt:{bf:stdipw}}Abadie (2005) inverse probability weighting DiD estimator with stabilized weights{p_end}
{synopt:{bf:aipw}}Abadie (2005) inverse probability weighting DiD estimator{p_end}
{synopt:{bf:ipwra}}Inverse-probability-weighted regression adjustment (via teffects){p_end}
{synopt:{bf:all}}Compute all of the above{p_end}
{synoptline}

{marker dr-did-with-ipw-and-ols}{...}
{dlgtab:DR DiD with IPW and OLS}

{pstd}Sant’Anna and Zhao (2020a) doubly robust DiD estimator based on stabilized inverse probability weighting and ordinary least squares{p_end}
{marker options-1}{...}
{dlgtab:Options}

{synoptset tabbed}{...}
{synopthdr:Option}
{synoptline}
{synopt:{bf:rc1}}When using repeated crossection data, the option {bf:rc1} requests the doubly robust, but not locally efficient, {bf:drimp} and {bf:dripw} estimators.{p_end}
{synopt:{bf:nosily}}Request showing the estimation of all intermediate steps.{p_end}
{synoptline}

{marker did-with-ipw}{...}
{dlgtab:DiD with IPW}

{pstd}Abadie (2005) inverse probability weighting DiD estimator{p_end}
{marker remarks}{...}
{dlgtab:Remarks}

{pstd}The command may create additional variables in the dataset. {cmd:__att__} stores the recentered influence function for the estimated statistic and {cmd:__dy__} stores the change in the outcome for an individual (when panel data is used). These variables are overwritten everytime the command is run.{p_end}

{marker did-with-or}{...}
{dlgtab:DiD with OR}
{pstd}The command also returns, as part of {cmd:e()}, the coefficients and variance covariance matrixes associated with all intermediate sets. See {cmd:ereturn list} after running the command.{p_end}

{pstd}Outcome regression DiD estimator based on ordinary least squares{p_end}

{marker examples}{...}
{title:Examples}

{marker did-with-stabilized-ipw}{...}
{dlgtab:DiD with stabilized IPW}
{phang2}{cmd}. use https://friosavila.github.io/playingwithstata/drdid/lalonde.dta, clear

{pstd}Abadie (2005) inverse probability weighting DiD estimator with stabilized weights{p_end}

{pstd}Panel estimator with default {bf:drimp} method{p_end}

{marker authors}{...}
{title:Authors}
{phang2}{cmd}. drdid re age educ black married nodegree hisp re74 if treated==0 | sample==2, ivar(id) time(year) tr(experimental)


{marker authors-1}{...}
{dlgtab:Authors}
{pstd}Repeated cross section{p_end}

{text}{phang2}Fernando Rios-Avila (Levy Economics Institute of Bard College), {it:maintainer}{p_end}
{phang2}Asjad Naqvi (International Institute for Applied Systems Analysis){p_end}
{phang2}{cmd}. drdid re age educ black married nodegree hisp re74 if treated==0 | sample==2, time(year) tr(experimental)



{marker contributors}{...}
{dlgtab:Contributors}
{marker authors}{...}
{title:Authors}

{text}{phang2}Miklós Koren (Central European University){p_end}
{text}{phang2}Fernando Rios-Avila (Levy Economics Institute of Bard College), {it:maintainer}{p_end}
{phang2}Asjad Naqvi (International Institute for Applied Systems Analysis){p_end}
{phang2}Pedro H. C. Sant'Anna (Vanderbilt University){p_end}


Expand All @@ -83,7 +99,7 @@
{pstd}You are free to use this package under the terms of its {browse "LICENSE":license}. If you use it, please cite {it:both} the original article and the software package in your work:{p_end}

{text}{phang2}Sant’Anna, Pedro H. C., and Jun Zhao. 2020a. “Doubly Robust Difference-in-Differences Estimators.” {it:Journal of Econometrics} 219 (1): 101–22.{p_end}
{phang2}Rios-Avila, Fernando, Asjad Naqvi (authors), Miklós Koren and Pedro H. C. Sant'Anna (contributors). 2021. “DRDID: Doubly Robust Difference-in-Differences Estimators for Stata.” [Software] Available at {browse "https://github.com/friosavila/csdid_drdid/":https://github.com/friosavila/csdid_drdid/}{p_end}
{phang2}Rios-Avila, Fernando, Asjad Naqvi and Pedro H. C. Sant'Anna. 2021. “DRDID: Doubly Robust Difference-in-Differences Estimators for Stata.” [Software] Available at {browse "https://github.com/friosavila/csdid_drdid/tree/v0.1":https://github.com/friosavila/csdid_drdid/tree/v0.1}{p_end}



Expand Down
Loading

0 comments on commit 5ddbe9a

Please sign in to comment.