Announcement

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

  • how to report the value of "Stock-Yogo weak ID test critical values: 10% maximal IV size" after ivreg2 from outreg2

    hello dear all,
    I want to add the value of the "Stock-Yogo weak ID test critical values: 10% maximal IV size" after ivreg2 but it is not reported. even after ivreg2, I check the "ereturn list" command but there is no specific command. also I want to add the report of f-test , which I recieve error. I appreciate any assistance you can provide.

    Code:
    *** Ftest table
    xtset weo_code year
    foreach v in "lngdpq"   {
    forvalues i=0/0         {
    
    ivreg2 `v'_`i' (shock_l shock_h=shock_exl shock_exh) l(1/2)shock l(1/2)lngdpq  i.weo_code i.year , cluster(weo_code)
    test shock_l -shock_h=0
    matrix b= e(b)
    local sh_l = b[1,1]*0.10190582*100
    
    matrix b= e(b)
    local sh_h = b[1,4]*0.10190582*100
    
    outreg2 using myfile, replace label keep(shock_l  shock_h l(1/2)shock l(1/2)lngdpq ) addstat(sh_l, `sh_l', sh_h, `sh_h',F-test, `r(F)' , p-value, `r(p)', Kleibergen-Paap_rk_Wald_F_statistic, `e(widstat)',Stock-Yogo weak ID 10%, `e(   )' )  excel
    }
    }

    Many thanks in advance.


    Best regards,

    Last edited by Khati Zolfaghari; 21 Mar 2023, 03:12.

  • #2
    Hello dear all,
    I just share how to solve the issue of reporting the F test in the ivreg2. Basically, the results are based on "chi2". so, can report the report of the chi2 in this way.

    Code:
    xtset weo_code year 
    foreach v in "lngdpq"   {
    forvalues i=0/0         {
    
    ivreg2 `v'_`i' (shock_l shock_h=shock_exl shock_exh) l(1/2)shock l(1/2)lngdpq  i.weo_code i.year, cluster(weo_code)
    test shock_l-shock_h=0
    
    matrix p= (r(p))
    local p1=p[1,1]
    
    matrix f=(r(chi2))
    local f1=f[1,1]
    
    
    
    
    outreg2 using myfile, replace label keep(shock_l  shock_h l(1/2)shock l(1/2)lngdpq ) addstat(sh_l, `sh_l', sh_h, `sh_h',F-test, `f1' , p-value, `p1', Kleibergen-Paap_rk_Wald_F_statistic, `e(widstat)')  excel 
    }
    }
    I hope it helps everyone.


    Best regards,


    Comment

    Working...
    X