Announcement

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

  • Combining nlcom with esttab

    Hi,

    I have been struggling with these codes for sometime. I am running regressions with esttab to creat a table of output. The codes are below and the excel table is attached.

    HTML Code:
    foreach cat in _pctchg  on_pctchg off_pctchg {
    foreach cat2 in _large _medium _small {
    
    
    
    reg LC`cat' L(1/4).LC`cat' L(1/4).MPU L(1/4).Dcrisis L(1/4).CrisisInteraction L.eqt_stand L(1/4).dy L(1/4).dr L(1/4).cexp i.quarter q_date if sz`cat2'==1         
                        // DFITS procedure finds outliers
                        predict dfits if e(sample), dfits
                        gen flag1 = dfits > 2*sqrt((e(df_m)+1)/e(N))
                        gen flag2 = dfits < -2*sqrt((e(df_m)+1)/e(N))
                        gen flag = flag1 + flag2
                        tab flag if e(sample)
                    
    eststo: quietly reg LC`cat' L(1/4).LC`cat' L(1/4).MPU L(1/4).Dcrisis L(1/4).CrisisInteraction L.eqt_stand L(1/4).dy L(1/4).dr L(1/4).cexp i.quarter q_date if  sz`cat2' ==1 & flag==0
    
    drop dfits flag*
    
    }
    }
    esttab using Step1Results.csv ,cells(b(fmt(3) star) se(par)) r2 scalars(F) replace
     
    The problem is that I don't know how to incorporate lincom with esttab when I want to report the sum of lag coefficients and their standard error.
    I can make my codes as follows

    HTML Code:
    foreach cat in _pctchg  on_pctchg off_pctchg {
    foreach cat2 in _large _medium _small {
    
    
    
    reg LC`cat' L(1/4).LC`cat' L(1/4).MPU L(1/4).Dcrisis L(1/4).CrisisInteraction L.eqt_stand L(1/4).dy L(1/4).dr L(1/4).cexp i.quarter q_date if sz`cat2'==1         
                        // DFITS procedure finds outliers
                        predict dfits if e(sample), dfits
                        gen flag1 = dfits > 2*sqrt((e(df_m)+1)/e(N))
                        gen flag2 = dfits < -2*sqrt((e(df_m)+1)/e(N))
                        gen flag = flag1 + flag2
                        tab flag if e(sample)
                    
    eststo: quietly reg LC`cat' L(1/4).LC`cat' L(1/4).MPU L(1/4).Dcrisis L(1/4).CrisisInteraction L.eqt_stand L(1/4).dy L(1/4).dr L(1/4).cexp i.quarter q_date if  sz`cat2' ==1 & flag==0
    
    drop dfits flag*
    lincom L1.LC`cat'+L2.LC`cat'+L3.LC`cat'+L4.LC`cat'
    lincom L1.MPU+L2.MPU+L3.MPU+L4.MPU
    lincom L1.Dcrisis+L2.Dcrisis+L3.Dcrisis+L4.Dcrisis
    lincom L1.CrisisInteraction+L2.CrisisInteraction+L3.CrisisInteraction+L4.CrisisInteraction
    lincom L1.dy+L2.dy+L3.dy+L4.dy
    lincom L1.dr+L2.dr+L3.dr+L4.dr
    lincom L1.cexp+L2.cexp+L3.cexp+L4.cexp
    }
    }
    esttab using Step1Results.csv ,cells(b(fmt(3) star) se(par)) r2 scalars(F) replace
     
    but then how to link the output of lincom to esttab?
    Attached Files

  • #2
    You could add the results returned by -lincom- using the -estadd- option (which saves the results stored in -return list-). The estimates can now be retrieved by -esttab-. Please see http://repec.org/bocode/e/estout/estadd.html

    Comment

    Working...
    X