Announcement

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

  • Report statistics of the first stage output with several instrumented variables

    Dear all,

    I have a model with several variables that I instrument for.
    I run a ivreghdfe model and use the first command to report my output. This workes perfectly. The issue is, that I also try to report statistics, such as the adjusted Rsquared.
    Unfortunatly, when running my command, the same adjusted R is reported for every of the instrumented variables. However, they should differ. I tryed the append command (simular as if i loop over regressions) , which did not work out. Can someone help me with my misstake here? My code is:


    eststo m1: ivreghdfe endog_var exog_var(Instrumeted1 Instrumeted2 Instrumeted3= Instrument1 Instrument2 Instrument3) , first savefirst savefprefix(s1)

    qui reg `e(instd)' `e(insts)' if e(sample)
    local r2a= e(r2_a)
    est restore m1
    estadd scalar r2a = `r2a': s1*

    esttab s1* using file.tex, replace ///
    stats(r2a , labels( "Adj. R2" )) ///
    compress star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(N) b(4)

  • #2
    Because you do not provide any reproducible example, you are responsible for any errors in the following suggestion:

    Code:
    eststo m1: ivreghdfe endog_var exog_var(Instrumeted1 Instrumeted2 Instrumeted3= Instrument1 Instrument2 Instrument3) , first savefirst savefprefix(s1)
    
    local i 1
    foreach instd in Instrumeted1 Instrumeted2 Instrumeted3{
         qui reg `instd' `e(insts)' if e(sample)
         local r2a_`i'= e(r2_a)
         est restore m1
         estadd scalar r2a_`i' = `r2a_`i'': s1*
         local++i
    }     
    
    esttab s1* using file.tex, replace ///
    stats(r2a_1 r2a_2  r2a_3, labels( "Adj. R2: Instrumented 1"  "Adj. R2: Instrumented 2" "Adj. R2: Instrumented 3" )) ///
    compress star(+ 0.10 * 0.05 ** 0.01 *** 0.001) scalars(N) b(4)
    Last edited by Andrew Musau; 03 Nov 2022, 08:30.

    Comment


    • #3
      Perfect, thank you so much. It works perfectly!

      Comment


      • #4
        May I also ask you how you do this for the normal IV regression if I run a loop over the endogenous variable? Also here I get only only one output reported for my statistics.
        I tryed to modeify your code, however, I failed to do so. Thanks a lot!

        The code is:


        global endog_var "1,2,3"

        foreach c of global endog_var {

        eststo `c': qui ivreghdfe `c' controlos (....including IV, absorb anc cluster)
        }

        esttab using myfile.tex, replace ///
        stats(arf arfp widstat idstat idp N, labels ( "Anderson–Rubin F-stat" "Anderson–Rubin p-value" "Kleibergen–Paap F-stat" "Kleibergen–Paap test" "Kleibergen–Paap p-value" "Obs")) ///

        Comment


        • #5
          As I stated in your previous thread and this one, you need to create a reproducible example. I was just kind to offer a solution without one here. Not only will it make things easier for me, but such an example will help others who are faced with a similar problem in the future.

          Comment

          Working...
          X