Hello Stata Forum,

I am running a staggered TWFE with dynamic/heterogenous effects and a continuous treatment. My code is as follows:

Code:
 did_multiplegt ch4hh county_fips year cs_treatshare, controls(AvgHHSize Population demshare MedianIncome RenterFraction facnum) breps(10) cluster(county_fips)placebo(5) dynamic(5) robust_dynamic average_effect
This gets me an average effect, but it is the incorrect one. The average effect I would like is weighed. I try to weigh it accordingly by specifying
Code:
average_effect("prop_number_switchers")
:

Code:
 did_multiplegt ch4hh county_fips year cs_treatshare, controls(AvgHHSize Population demshare MedianIncome RenterFraction facnum) breps(10) cluster(county_fips)placebo(5) dynamic(5) robust_dynamic average_effect("prop_number_switchers")
However, I get an error that says
Code:
option average_effect() incorrectly specified
.

I couldn't figure out why this was, so I looked into the source code of average_effect in did_multiplegt. I still couldn't find anything. Below is the source code:

Code:
/////// Computing average effect, if option requested

if "`average_effect'"!=""{
scalar average_effect_int=0
scalar var_average_effect_int=0
scalar N_average_effect_int=0
*NEWW
scalar N_switch_average_effect_int=0
*END NEWW

//// Computing weights

*NEWW

/*
// Weights for simple average

if "`average_effect'"=="simple"{
scalar check_cov=1
matrix Weight=J(`dynamic'+1,1,1/(`dynamic'+1))
}

// Weights proportionnal to number of switchers for which each effect is estimated

if "`average_effect'"=="prop_number_switchers"{
scalar check_cov=1
scalar total_switchers=0
forvalue i=0/`=`dynamic''{
matrix Weight[`i'+1,1]=N_switchers_effect_`i'_2
scalar total_switchers=total_switchers+N_switchers_effect_`i'_2
}
matrix Weight=Weight*(1/total_switchers)

Any help would be greatly appreciated. I'm not sure why I am incorrectly specifying average_effect.

Best,
David W.