Announcement

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

  • Storing J-stat / F-stat from ivregress gmm

    Hi all,

    I'm having trouble keeping the stored results from "estat overid" and "estat firststage". I feel like I'm doing everything "correct", but the results are not tabulating in esttab properly.

    I run:

    ivregress gmm tempvar $ctractX i.year $stX i.ind1 i.st i.occ1 (contract=$ctractinst) [w=weight], robust
    estat overid, forceweights
    local estadd jstat=r(p_HansenJ), replace
    estat firststage
    local estat fstat=r(singleresults), replace

    When I get to esttab, I include:

    stats (r2 N fstat jstat, label("R-squared" "Sample Size" "F-stat" "J-stat")

    However, nothing comes up on either of the spaces for f-stat or j-stat. Anyone else have experience tabulating these?

  • #2
    1. You define local but not calling to local in the esttab command, you should better use scalar instead of local.
    2. fstat=r(singleresults) is a matrix and not value, so you need to choose which value of this matrix you want. The F-stat is the fourth value of the matrix (type matrix list fstat to access its content)
    Here's a way of doing that:
    Code:
    clear*
    webuse hsng2
    ivregress gmm rent pcturban (hsngval = faminc i.region), vce(unadjusted)
    est store gmm
    estat overid
    estadd scalar jstat=r(p_HansenJ), replace
    estat firststage
    mat fstat=r(singleresults)
    estadd scalar fstat1=fstat[1,4], replace
    
    esttab gmm, stats (r2 N fstat1 jstat, label("R-squared" "Sample Size" "F-stat" "J-stat")) ​

    Comment


    • #3
      Wow, fantastic job Oded, that's spot on and exactly what I was hoping someone would be able to clarify. Thanks a bunch -- I wouldn't have gathered that from the help document with ivregress online!

      Comment


      • #4
        Hi Oded / everyone,

        I was applying the same coding strategy for another paper to test the instruments, and for some reason the first stage "fstat=r(singleresults)" just appears missing, with a ".".

        Does anyone know what could be causing this? If you look at the actual first stage, the F stat is high and reasonable looking.

        Comment

        Working...
        X