Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
s
  • Loading branch information
friosavila committed May 1, 2024
1 parent 6f09f75 commit 3f0023a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 14 deletions.
10 changes: 6 additions & 4 deletions jwdid/jwdid.ado
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,9 @@ program jwdid, eclass
if "`method'"=="" {
if "`group'"=="" {
** ogxvar will be excluded if they are fixed across time
if "`tocluster'"=="" local tocluster vce(robust)
reghdfe `y' `xvar' `ogxvar' `otxvar' `exogvar' ///
if `touse' [`weight'`exp'], abs(`ivar' `tvar' `fevar') `tocluster' keepsingletons
if `touse' [`weight'`exp'], abs(`ivar' `tvar' `fevar') `tocluster' keepsingletons `options'
local scmd `e(cmdline)'
}
else {
Expand All @@ -633,14 +634,15 @@ program jwdid, eclass
}
}
reghdfe `y' `xvar' `x' `ogxvar' `otxvar' `exogvar' `xcorr' ///
if `touse' [`weight'`exp'], abs(`gvar' `tvar' `fevar') `tocluster' keepsingletons noempty
if `touse' [`weight'`exp'], abs(`gvar' `tvar' `fevar') `tocluster' keepsingletons noempty `options'
local scmd `e(cmdline)'
}
}
else if "`method'"=="ppmlhdfe" {

ppmlhdfe `y' `xvar' `ogxvar' `otxvar' `exogvar' ///
if `touse' [`weight'`exp'], abs(`ivar' `tvar' `fevar') `tocluster' keepsingletons ///
d `method_option'
d `method_option' `options'
local scmd `e(cmdline)'
}
else {
Expand All @@ -654,7 +656,7 @@ program jwdid, eclass
}
}
`method' `y' `xvar' `x' `ogxvar' `otxvar' `xcorr' `exogvar' i.`gvar' i.`tvar' ///
if `touse' [`weight'`exp'], `tocluster' `method_option'
if `touse' [`weight'`exp'], `tocluster' `method_option' `options'
local scmd `e(cmdline)'
}

Expand Down
48 changes: 38 additions & 10 deletions jwdid/jwdid.sthlp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{smcl}
{* *! version 1.1 2_feb_2023}{...}
{* *! version 2.0 May_4_2024}{...}
{title:Title}

{phang}
{bf:jwdid} {hline 2} DID estimator using Mundlak approach
{bf:jwdid} {hline 2} ETWFE-DID estimator


{marker syntax}{...}
Expand All @@ -17,17 +17,45 @@
[{cmd:,} {it:options}]

{synoptset 20 tabbed}{...}

{synopthdr}
{synoptline}
{synopt:{opt i:var(varname)}}Declares the Panel ID variable{p_end}
{syntab :Basic Specification options}
{synopt:{opt i:var(varname)}}Declares the Panel ID variable. If not declared, the data is assumed to be Repeated crossection. {p_end}
{synopt:{opt t:var(varname)}}Declares the time variable{p_end}
{synopt:{opt time(varname)}}Same as tvar() {p_end}
{synopt:{opt g:var(varname)}}Provides the cohort variable{p_end}
{synopt:{opt trtvar(varname)}}If no Gvar is available, you can provide the post-treatment variable. This works if data is panel.{p_end}
{synopt:{opt trgvar(varname)}}If data is RC, you can use trtvar() option with this one. It should be a pseudo panel id in your data for people who share the treatment status at the same time{p_end}
{synopt:{opt never}}Request using Never treated as control group. Default is using not yet treated. Using this, will exclude g-1 period from the interactions {p_end}
{synopt:{opt group}}Request using Group fixed effects instead of Panel ID fixed effects. In linear models, with balanaced panel, estimates are numerically identical{p_end}
{synopt:{opt method(method name, options)}}Request other methods for the estimation of ATT's. For example {cmd:poisson} or {cmd:logit}.
Default is linear regression model. One can also add some options for other methods (GLM for example){p_end}

{syntab :Treatment-control Specification options}
{synopt:{opt trtvar(varname)}}If Gvar is not available, you can provide the post-treatment variable. By default, the panel data identifier is used to create the equivalent to Gvar{p_end}
{synopt:{opt trgvar(varname)}}If data is repeated crossection (RC), {cmd:trtvar()} can be combined with {cmd: trtgvar()} to identify the cohort variable. {cmd:trtgvar} should identify a pseudo panels in the data, where each pseudo panel are observations that were (or could have) been treated at the same point in time{p_end}

{syntab :Basic DID Specification options}
{synopt:{opt never}}By default, {cmd: jwdid} uses all never and not-yet treated observations as controls. The option {cmd: never} request to use only never-treated as the control group. With this option, for each group/cohort, the period g-1 is excluded from the specification. {p_end}
{synopt:{opt group}}Request using Group fixed effects instead of Panel ID fixed effects. In linear models, with balanaced panel, estimates are numerically identical. However, it may reduce the computational burden with nonlinear models. This is the default whenver {cmd: method()} is called for except for {cmd: ppmlhdfe}.{p_end}
{synopt:{opt corr}}When using {cmd:group} with unbalanced panel data, estimates are no longer identical to those that use the panel identifier fixed effect. The option {cmd:corr} applies a correction for this, following a Mundlak approach{p_end}

{synopt:{opt cluster(varname)}} This option is used to request standard errors to be clustered at {cmd: cluster()} level. When using panel data, the default is using {cmd:ivar()} for clustering standard errors. When using RC data, Standard errors are estimated based on the Method default. For {cmd:reghdfe}, one should use {cmd:vce(robust)} to obtain robust standard errors.{p_end}

{synopt:{opt method(method_name)}}Request other methods for the estimation of ATT's. For example {cmd:poisson} or {cmd:logit}. Default is linear regression model, which is estimated using {cmd: reghdfe}.{p_end}

{synopt:{opt other_options}}It is also possible to request other method/specific options. For example, for {cmd:reghdfe} robust standard errors can be requested using {cmd: vce(robust)}.{p_end}

{syntab :Advanced DID Specification options}
{synopt:{opt hettype(hetspec)}}This option allows to request different types of treatment effect heterogeneity. The default is to use full timecohort heterogeneity. Other options include {cmd:time}, {cmd:cohort}, {cmd: event} and {cmd:twfe}. The last one reduces to the traditional TWFE estimator {p_end}

{synopt:{opt xasis}}Unless this option is requested, all variables in {cmd:varlist} are demeaned and interacted with the corresponding level of treatment heterogeneity. Declaring {cmd: xasis} requests using covariates without transformation.

{synopt:{opt exovar(varlist)}} Variables declared using this option are added to the model specification without interactions{p_end}

{synopt:{opt xtvar(varlist)}}Variables declared are only interacted with the time variable{p_end}

{synopt:{opt xgvar(varlist)}}Variables declared are only interacted with the group/cohort variable.{p_end}

{synopt:{opt fevar(varlist)}}This option is used to add additional fixed effects to the model, that different from cohort, panel or time. Only valid when using default method (reghdfe) or if using ppmlhdfe.{p_end}

{synopt:{opt anti:cipation(#1)}}This is used to declare period different from g-1 as the baseline. #1 can only take integer positve values, default is 1{p_end}


{synoptline}
{p2colreset}{...}
Expand All @@ -39,7 +67,7 @@ Default is linear regression model. One can also add some options for other meth
{title:Description}

{pstd}
{cmd:jwdid} is a program that implements the Extended TWFE estimator proposed by Jeff Wooldridge for the estimation of ATT's based on a generalized DID design.
{cmd:jwdid} is a program that implements the Extended TWFE estimator proposed by Wooldridge(2022,2023) for the estimation of ATT's based on a generalized DID design.

{pstd}In principle, this estimator simply suggests that to avoid some of the negative aspects of the traditional TWFE-DID estimator, which uses already treated units as controls causing the so-called negative weights, one should simply use a fully interacted set of dummies allowing for treatment effect heterogeneity by cohort and timing.

Expand Down

0 comments on commit 3f0023a

Please sign in to comment.