Announcement

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

  • Include "normdiff" in summary statistic table using "esttab "

    Dear Stata users,

    I am using Stata 13.1 and I would like to create a table containing summary statistics split by treatment and control group. This table should also include a column containing the normalized difference (Imbens & Wooldridge, 2009) between control and treatment group for each variable. I therefore use the command "normdiff" provided by Keith Kranker.

    Unfortunately these normalized differences are not added to my table (last column) and I have no idea why.

    Please find below an example using Stata's union.dta. I treat the variable union as treatment, age and grade are the variables I want to have the summary statistics.

    Code:
        use http://www.stata-press.com/data/r13/union.dta, clear
        eststo clear
        
        eststo Total:    estpost sum age grade if union!=., det
        eststo NonCrisis: estpost sum age grade if union==0, det
        eststo Crisis:      estpost sum age grade if union==1 , det
        eststo Diff:     estpost ttest age grade, by(union) welch
        
        normdiff age grade, over(union) n(off)
        matrix normdiff1 = e(normdiff)
        estadd matrix normdiff1 = normdiff1
            
        esttab , noobs noisily nonumb booktabs replace ///
        cells("count(pattern(1 1 1 0) fmt(%12.0fc))mean(fmt(3) pattern(1 1 1 0)) b(fmt(3) pattern(0 0 0 1)) normdiff1(fmt(3) pattern(0 0 0 1))")
    I appreciate any advice!
    Catharina

  • #2
    I found my mistake, I just have to transpose the matrix normdiff1. Actually, the code has to like this:

    Code:
        use http://www.stata-press.com/data/r13/union.dta, clear
        eststo clear
        
        eststo Total:    estpost sum age grade south if union!=., det
        eststo NonCrisis: estpost sum age grade south if union==0, det
        eststo Crisis:      estpost sum age grade south if union==1 , det
        eststo Diff:     estpost ttest age grade south, by(union) welch
        
        normdiff age grade south, over(union) n(off)
        matrix normdiff1 = e(normdiff)'
        estadd matrix normdiff1 = normdiff1:Diff
            
        esttab , noobs noisily nonumb booktabs replace ///
        cells("count(pattern(1 1 1 0) fmt(%12.0fc))mean(fmt(3) pattern(1 1 1 0)) b(fmt(3) pattern(0 0 0 1)) normdiff1(fmt(3) pattern(0 0 0 1))")

    Comment

    Working...
    X