Announcement

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

  • estab problem with booteset

    Hi there,

    I ran xtreg and tried to save the results from a post estimation bootest command to a latex table via estout but cannot get it to work. The entry for the confidence intervals is empty (i have tried many variants of the code below):

    Code:
     quietly eststo: xtreg y x1 x2, fe 
    estadd scalar R = 100*(e(r2))
    estadd scalar Nobs = e(N)
    boottest {x1} {x2}, boottype(wild) weight (rademacher) seed(1) cluster(countryId) level(95) nograph
    matrix ci_temp = r(CI_2)
    scalar boot_ci_lb_temp = ci_temp[1,1]
    scalar boot_ci_ub_temp = ci_temp[1,2]
    estadd scalar boot_ci_lb = boot_ci_lb_temp
    estadd scalar boot_ci_ub = boot_ci_ub_temp
    
    
    esttab using "Panel_Regression.tex", replace ///
        cells(b   /// 
        boot_ci_lb(fmt(a3) par(`"["' `","')) ///
        & boot_ci_ub(fmt(a3) par(`""' `"]"')))
    How can I generate a table where the main body includes such extra results (in addition to the betas etc)?

  • #2
    boottest and estout are from SSC (FAQ Advice #12). See #9 https://www.statalist.org/forums/for...t-few-clusters

    Comment


    • #3
      Sure I understand that - my issue is not installing the packages - my issue is that the above snippet does not print a bootstrapped confidence interval below the beta (b).

      Comment


      • #4
        The linked thread shows you how to do it, except that you have to adapt it for CIs. Output 2 statistics in place of one and add brackets at the beginning of the first and at the end of the second. Sorry, I don't have time to be more detailed, but this additional link may help https://www.statalist.org/forums/for...ence-intervals.

        Comment


        • #5
          Hi there,

          Thanks for the reply. I went through the link you provided and and adapted the suggestion solution with a dummy code. Here is what I have

          Code:
          sysuse auto, clear
          quietly: regress mpg weight displacement
          *SAVE CIs FROM BOOTEST
          boottest {weight} {displacement}, boottype(wild) weight (rademacher) seed(1) level(95) nograph
          matrix ci_temp1 = r(CI_1)
          mat colnames ci_temp1= "`:colnames r(b_1)'"
          matrix ci_temp2 = r(CI_2)
          matrix ll = (ci_temp1[1,1] , ci_temp2[1,1])
          matrix ul = (ci_temp1[1,2] , ci_temp2[1,2])
          mat colnames ci_temp1= "`:colnames r(b_2)'"
          *CREATE REDUNDANT MATRIX WITH UNIQUE ENTRIES
          mat end= (1, 1)
          mat colnames end= "`:colnames r(b_2)'"
          *ESTADD MATRICES
          estadd matrix myll= ll
          estadd matrix myul= ul
          estadd matrix end= end
          *ESTTAB WITH CUSTOM CIs
          esttab ., cells(b_1 myll(par("["))&myul&end(par("]")) ) substitute (", ]1" "]")
          This is close but not quite there. What am I doing wrong?

          Thanks in advance and happy new year !

          Comment


          • #6
            Code:
            -------------------------
                                  (1)
                                  mpg
                         b_1/myll/m~d
            -------------------------
            c1                       
                         [-.0090186 -.0040877 
            c2                       
                         [-.0120009 .0240099 
            displacement             
                                   ]1
            displacement             
                                   ]1
            -------------------------
            N                      74
            -------------------------

            Comment


            • #7
              Code:
              clear all
              sysuse auto
              quietly: regress mpg weight displacement
              *SAVE CIs FROM BOOTEST
              boottest {weight} {displacement} {_cons}, boottype(wild) weight (rademacher) seed(1) level(95) nograph
              matrix ll = (r(CI_1)[1,1] , r(CI_2)[1,1], r(CI_3)[1,1])
              matrix ul = (r(CI_1)[1,2] , r(CI_2)[1,2], r(CI_3)[1,2])
              mat end= (1, 1, 1)
              mat colnames ll= `:colnames e(b)'
              mat colnames ul= `:colnames e(b)'
              mat colnames end= `:colnames e(b)'
              *ESTADD MATRICES
              estadd matrix myll= ll
              estadd matrix myul= ul
              estadd matrix end=end
              *ESTTAB WITH CUSTOM CIs
               esttab ., cells(b myll(par("["))&myul&end(par("]"))) substitute (" ]1" "]") label collab(none) nonumb varwidth(25) noabbrev
              Res.:

              Code:
              . *ESTTAB WITH CUSTOM CIs
              .  esttab ., cells(b myll(par("["))&myul&end(par("]"))) substitute (" ]1" "]") label collab(none) nonumb varwidth(25) noabbrev
              
              --------------------------------------
                                        Mileage (mpg)
              --------------------------------------
              Weight (lbs.)                -.0065671
                                        [-.0090186 -.0040877]
              Displacement (cu. in.)        .0052808
                                        [-.0120009 .0240099]
              Constant                      40.08452
                                        [35.68482 44.57381]
              --------------------------------------
              Observations                        74
              --------------------------------------

              Comment


              • #8
                Thanks ! Think I understand the syntax now

                Comment

                Working...
                X