0
votes

This is a 2-arm randomized control trial. In my regression output I want to evaluate the relative reduction in risk of disease for those in the treatment group. To make this evaluation easier I would like to add the dependent variable control mean to the foot of the regression table output. I am currently using estadd with estout. Below is my code, which displays the mean of the dependent variable, however I cannot find any options for estadd, estpost, etc that allow me to restrict the depvar mean calculation for only one arm of the study (i.e. control arm).

    eststo, title(" "): xi: quietly reg X `covariates' if survid==1, vce(cluster id1)
    estadd ysumm
    estout using $outdir\results.txt, replace ///
      cells("b(fmt(3) label (Coeff.))  se(fmt(3) star label (s.e.))") /// 
      drop(_Itt* _cons)     ///
      starlevels(+ 0.10 * 0.05) ///
      stats(N ymean, labels ("N. of obs." "Control Mean"))            ///               
      label legend 
1
Welcome to the site. I made your question look prettier with code formatting.StasK

1 Answers

3
votes

You are being spoiled by the marvelous functionality offered by estadd, eststo, etc. :). How about this:

xi: quietly reg X `covariates' if survid==1, vce(cluster id1)
   // two prefixes in the same command is like a sentence with three subordinate clauses
   // that just rolls from one line to the next without giving you a chance to 
   // catch a breath and really understand what is going on in this sentence,
   // which is a sign of poor writing skills, unless you are Dostoevsky, which I am not.
estimates store CtrlArm
   // it is also a good idea to be specific about what it is that you want to output.
   // Thus I have the -estimates store- on a separate line with a specific name for your results.
summarize X if survid==1
estadd scalar ymean = r(mean) 
estout CtrlArm using $outdir\results.txt, ...

estadd and estout are unavoidable. Your initial eststo with an empty title just takes space, though, and does not help anything.