Hi everyone,
I am running a bootstrap exercise to estimate the standard errors of Lee bounds. I have created a program that computes the bounds and then I bootstrap the bounds 10,000 times. The code is below. The bounds are calculated based on the output of the command rdrobust (RDD estimation).
The code was running smoothly until I switched to Stata 18 (and it runs fine for my co-author who is still using the 17 version). Now that I have switched to Stata 18, when I run it, I obtain the following error message: "type mismatch: exp.exp: transmorphic found where struct expected
r(3000);". The error message appears right before the first bootstrap replication is supposed to start.
Here is the code that bootstraps the lower and upper bounds of the effect of the treatment on the probability that the incumbent wins the election conditional on running. For some background, the RDD estimation assesses the impact of campaign finance regulations on the probability that the incumbent runs and wins the election. The threshold used is a 9,000 inhabitants threshold below which districts are not subject to the rule. The running variable (named running) is the district's population centered at 9,000.
Do you have any idea of why the code is not working anymore?
Any help greatly appreciated!
Thanks in advance,
Best,
Clemence
I am running a bootstrap exercise to estimate the standard errors of Lee bounds. I have created a program that computes the bounds and then I bootstrap the bounds 10,000 times. The code is below. The bounds are calculated based on the output of the command rdrobust (RDD estimation).
The code was running smoothly until I switched to Stata 18 (and it runs fine for my co-author who is still using the 17 version). Now that I have switched to Stata 18, when I run it, I obtain the following error message: "type mismatch: exp.exp: transmorphic found where struct expected
r(3000);". The error message appears right before the first bootstrap replication is supposed to start.
Here is the code that bootstraps the lower and upper bounds of the effect of the treatment on the probability that the incumbent wins the election conditional on running. For some background, the RDD estimation assesses the impact of campaign finance regulations on the probability that the incumbent runs and wins the election. The threshold used is a 9,000 inhabitants threshold below which districts are not subject to the rule. The running variable (named running) is the district's population centered at 9,000.
Code:
** Program: program wincond_inc, eclass version 15 ** 1/ set temporary names for the scalars tempname coeff_run coeff_win R W ** 2/ store the coefficient for incumbent running (variable "run") + probability that the incumbent runs at the threshold on the left rdrobust incumbent_run_R1 running , vce(nncluster n_id_district) scalar `coeff_run'=e(tau_cl) scalar `R'=e(tau_cl_l) ** 3/ store the coefficient for winning unconditionally (ie with 0 when not running) rdrobust incumbent_win running, vce(nncluster n_id_district) scalar `coeff_win'=e(tau_cl) ** 4/ store the mean probability to win for an incumbent on the left of the threshold rdrobust win_cond_inc running, vce(nncluster n_id_district) scalar `W'=e(tau_cl_l) ** 5/ compute the bounds using Lee equations ereturn clear ereturn scalar upper_bound_inc=((`coeff_win'-`coeff_run'*(`W'))/(`R')) ereturn scalar lower_bound_inc=`coeff_win'/(`R') end ** Bounds use "Database construction/Database construction/Data files/main_analysis_file.dta" keep if election_type==2 & sample_main==1 keep incumbent_run_R1 running incumbent_win win_cond_inc n_id_district * Run the program and store the coefficient bootstrap lower_bound=e(lower_bound_inc) upper_bound=e(upper_bound_inc), reps(10000) seed(1000000) cluster(n_id_district): wincond_inc outreg2 using "Analyses/Tables/Bounds/incumbent_win_sample_`s'.xls", replace noobs nonotes bdec(3) sdec(3) stats(coef se tstat pval ci ci_low ci_high) clear }
Any help greatly appreciated!
Thanks in advance,
Best,
Clemence
Comment