Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bootstrap error message after switching to Stata 18

    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.

    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
    }
    Do you have any idea of why the code is not working anymore?
    Any help greatly appreciated!

    Thanks in advance,
    Best,
    Clemence

  • #2
    Clemence:
    is your copy of Stata 18 fully updated?
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Hi Carlo,
      Thanks!
      Yes I just double checked and it is fully updated
      Best,
      Clemence

      Comment


      • #4
        Hi everyone,
        Any take on this issue? Or any ideas on how to achieve the same with an alternative code?
        Thanks in advance for your help!
        Best,
        Clemence

        Comment


        • #5
          Without providing a dataset to reproduce this, you will find it hard to get any help.

          Can you run the rdrobust commands without bootstrap?

          Consider writing the authors of rdrobust, but you will need to provide them with a dataset that reproduces the problem.

          Comment


          • #6
            After receiving more information, it appears that rdrobust clears all Mata objects and Stata 18's bootstrap is using a global Mata object to manage the display of dots. Use option nodots to avoid this error for now.

            Comment


            • #7
              Hi Jeff,
              Thank you so much for looking into it, it works perfectly!
              All the best,
              Clemence

              Comment

              Working...
              X