Announcement

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

  • Combining p-values from several regressions with esttab

    Hello,

    I'm trying to use the esttab command to create a table with 3 columns: the 1st reporting (baseline) mean values of 4 variables for treated individuals in my study, the 2nd reporting the mean values of the same 4 variables for control individuals, and the 3rd reporting p-values from several regressions in which the variables listed in the first two columns are regressed on the treatment variable with controls (!). I'm having difficulty in combining the p-values from several regressions and have esttab recognise that the LHS variables are the same as the ones listed in the summary tables. Is there a way to do this?

    I'll paste below the method that I attempted, but this doesn't seem to work. (Stata says that 'estimation result r(coefs, is not found'.)

    Thank you very much!

    Code:
    eststo clear
    
    local time " igaNew school tuse1_iga tuse1_educ "
    foreach v of local time {
    eststo est_`v': qui: areg `v'B treat2 , a(s0a_district) cl(s0a_community)
    local list="`list' `v'B"
    }  
    eststo treatment: estpost summarize `list' if treat2==1
    eststo control: estpost summarize `list' if treat2==0
    
    esttab est_*, keep(treat2)
    
    esttab treatment control r(coefs, transpose) using "$path/0.tex", replace ///
    prehead("\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \setlength{\tabcolsep}{4pt} \begin{tabularx}{\textwidth}{p{0.33\linewidth} *{3}{>{\centering\arraybackslash}X}  } \multicolumn{4}{l}{\textbf{Balance}} \\[2ex] \hline\hline") ///
    posthead("\hline\hline \multicolumn{4}{l}{\textbf{Panel A}} \\[0.4ex] \hline") ///
        mtitle("Treated" "Control" "Difference (p-value)") nonote collabels( ,none) ///
        cell( ///
            mean(pattern(1 1 0) fmt(2)) & p(pattern(0 0 1) fmt(2)) ///
        ) ///
        fragment ///
        varlabels(igaNewB "=1 if started new IGA" schoolB "=1 if attended school" tuse1_igaB "Time spent with income generating activities" tuse1_educB "Time spent with education") ///
        postfoot("\hline\hline  \end{tabularx}") noobs
Working...
X