I am currently trying to add significance stars to a graph I generate via coefplot using matrices.
The Code I use is the following:
Code:
quietly regress coutcome1 i.treatment##i.interaction /// ${controls} , robust lincom 1.treatment local b = r(estimate)*100 local se = r(se) local pvalue = r(p) local t = r(t) local ll95 = r(lb)*100 local ul95 = r(ub)*100 local df = r(df) mat model1[1,5] = `b' \ `se' \ `t' \ `pvalue' \ `ll95' \ `ul95' \ `df' matrix colnames model1 = (1) (2) (3) (4) (5) matrix rownames model1 = b se t pvalue ll95 ul95 df lincom 1.treatment + 1.treatment#1.interaction local b = r(estimate)*100 local se = r(se) local pvalue = r(p) local t = r(t) local ll95 = r(lb)*100 local ul95 = r(ub)*100 local df = r(df) mat model2[1,1] = `b' \ `se' \ `t' \ `pvalue' \ `ll95' \ `ul95' \ `df' matrix colnames model2 = (1) matrix rownames model2 = b se t pvalue ll95 ul95 df [Repeat for more outcomes] quietly regress coutcome5 i.treatment##i.interaction /// ${controls} , robust lincom 1.treatment local b = r(estimate)*100 local se = r(se) local pvalue = r(p) local t = r(t) local ll95 = r(lb)*100 local ul95 = r(ub)*100 local df = r(df) mat model1[1,5] = `b' \ `se' \ `t' \ `pvalue' \ `ll95' \ `ul95' \ `df' matrix colnames model1 = (1) (2) (3) (4) (5) matrix rownames model1 = b se t pvalue ll95 ul95 df lincom 1.treatment + 1.treatment#1.interaction local b = r(estimate)*100 local se = r(se) local pvalue = r(p) local t = r(t) local ll95 = r(lb)*100 local ul95 = r(ub)*100 local df = r(df) mat model2[1,5] = `b' \ `se' \ `t' \ `pvalue' \ `ll95' \ `ul95' \ `df' matrix colnames model2 = (1) (2) (3) (4) (5) matrix rownames model2 = b se t pvalue ll95 ul95 df coefplot (matrix(model1), keep ( (1) (2) (3) (4) (5) ) ci((5 6)) mlabel(cond(@pval<.01, "***", cond(@pval<.05, "**", cond(@pval<.10, "*", "")))) ) /// (matrix(model2), keep ( (1) (2) (3) (4) (5) ) ci((5 6)) mlabel(cond(@pval<.01, "***", cond(@pval<.05, "**", cond(@pval<.10, "*", "")))) ), /// title( "Treatment Effect in Percentage Points" , size(large))
see: http://repec.sowi.unibe.ch/stata/coe...ted/plots1.pdf
Yet, when I try to add significance stars dependent on the p-values this approach crashes. I have the feeling that I have to access r(table) to add my coefficient results and trick coefplot into thinking that my matrices are regression outcomes.
Still, I do not know how to do that.
Can anybody please help?
All the best,
Fabian
0 Response to Adding Significance Stars to a Coefplot generated with Matrices
Post a Comment