将depvar控制均值添加到回归表输出

时间:2011-10-18 16:07:08

标签: stata

这是一项双臂随机对照试验。在我的回归输出中,我想评估治疗组患者的疾病风险相对降低。为了使评估更容易,我想将因变量控制均值添加到回归表输出的底部。我目前正在使用estadd estout。下面是我的代码,它显示因变量的平均值,但我找不到estaddestpost等的任何选项,这些选项允许我限制研究的一个分支的depvar平均值计算(即控制臂)。

    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 个答案:

答案 0 :(得分:3)

您被estaddeststo等提供的出色功能所破坏。怎么样:

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, ...

estaddestout是不可避免的。但是,带有空标题的初始eststo只占用空间,并没有任何帮助。