Announcement

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

  • Exporting F-Statistics and p-value after ivreg2 command

    Dear all,

    I am using
    Code:
    ivreg2
    command to do my analysis with Stata 15 (IC). However, I need to report the F-test of excluded instruments for my output table. I first, run the following code

    Code:
    ivreg2 sick (i.polluted=l_dur_value) female age schooling yhat rural yr2010 
    yr2014 yr2016 yr2018 i.newsoum if distance<20, first cluster(identif)
    then to get the F-statistics from the first-stage regression, I use the following

    Code:
    mat l e(first)
    The output is as follows:

    HTML Code:
    e(first)[21,1]
                     1.
              polluted
       rmse  .33124254
    sheapr2  .00110657
        pr2  .00110657
          F  10.484074
         df          1
       df_r       4557
     pvalue  .00121271
        SWF  10.484074
     SWFdf1          1
     SWFdf2       4557
       SWFp  .00121271
     SWchi2  10.521312
    SWchi2p  .00118006
       SWr2  .00110657
        APF  10.484074
     APFdf1          1
     APFdf2       4557
       APFp  .00121271
     APchi2  10.521312
    APchi2p  .00118006
       APr2  .00110657

    However, when I want to local the F-stat and the p-value with

    Code:
     local fstat_base = e(first)[4(e(first),"SWF"),1]
     local fpval_base = e(first)[7(e(first),"SWFp"),1]
    I get

    HTML Code:
    invalid syntax
    r(198);

    Can someone please help me where I am getting the code wrong in the local command? Is there any other way to store the F-stat and the p-value?

    Thanks a lot and your help is much appreciated!



  • #2
    Hi Odmaa,

    You may want to read this post: https://www.statalist.org/forums/for...-stage-outcome. Andrew provided lots of useful illustrations there.

    Hope this helps.

    Comment


    • #3
      Hi Dung Le,

      Thanks very much. That's very helpful.

      Comment

      Working...
      X