Announcement

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

  • Exporting Oster bound estimates

    Dear all,

    As a robustness check, I'm computing the Oster bounds on unobservables for a range of outcomes of interest. I use the psacalc command in Stata 14 as shown below. The command itself works fine and the delta is stored correctly in r(delta).

    Code:
    xtset id7
    xi: xtreg y x1 x2 $controls, fe vce(cluster id7)
    psacalc delta x1
    estadd scalar delta1 = r(delta)
    psacalc delta x2
    estadd scalar delta2 = r(delta)
    esttab est* using "...", ... stats(delta1 delta2 r2 N) ...
    The issue comes when I try to export the delta along with the main regression results. When I run the estadd command I get the following error:
    Code:
    estimates __000003 not found
    Do you know what the problem is and how to fix it? The same format using estadd works fine for means, for example, and I've made sure all commands are up-to-date.

    Many thanks,

    Ioana

  • #2
    I am not a user of esttab, but after some experimentation, I found that this avoided the problem.
    Code:
    sysuse auto, clear
    regress price foreign mpg weight headroom trunk
    estimates store est1
    
    psacalc delta weight
    scalar delta1 = r(delta)
    estimates restore est1
    estadd scalar delta1
    
    psacalc delta mpg
    scalar delta2 = r(delta)
    estimates restore est1
    estadd scalar delta2
    
    esttab est* using "~/Downloads/gnxl.txt", stats(delta1 delta2 r2 N) replace
    
    type "~/Downloads/gnxl.txt"
    Code:
    . type "~/Downloads/gnxl.txt"
    ----------------------------
                          (1)   
                        price   
    ----------------------------
    foreign            3654.8***
                       (5.39)   
    
    mpg                 14.43   
                       (0.20)   
    
    weight              3.781***
                       (5.58)   
    
    headroom           -615.7   
                      (-1.58)   
    
    trunk              -11.80   
                      (-0.13)   
    
    _cons             -4641.1   
                      (-1.37)   
    ----------------------------
    delta1              0.303   
    delta2            -0.0220   
    r2                  0.526   
    N                      74   
    ----------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    The key is apparently to use estmates store to store the estimates before running psacalc, storing r(delta) in a temporary scalar after running psacalc, then run estimates restore before estadd.

    Comment


    • #3
      Not related to the original post, but the -xi- prefix is not necessary and, in fact, is not recommended. Since Stata 12 (as I recall), we have been able to write factor variable syntax directly in the model without using -xi-.
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        Seems like William Lisowski's answer solves the issue.
        There is also the question of whether you want to export beta or delta.
        Both delta values and beta values are of interest after -psacalc-. The delta values show the proportional degree of selection that makes beta equal to 0 (or the value you specify). The beta values are the bounds for the coefficient given a degree of selection.
        Jorge Eduardo Pérez Pérez
        www.jorgeperezperez.com

        Comment


        • #5
          Just getting started with the -psacalc- code using:
          sysuse auto, clear
          regress price foreign mpg weight headroom trunk


          I was surprised to see that beta moved in a nonlinear fashion with delta.

          psacalc beta weight, delta(0) -

          Beta | 3.78137

          psacalc beta weight, delta(1)

          Beta | 16.58128

          psacalc beta weight, delta(2) -

          Beta | 1.45388


          Is that to be expected?

          Comment

          Working...
          X