Dear Statalist,
Please consider the following table. I would like to assign stars to coefficients (_r_b) based on their p-values (_r_p), and to assign stars to the F statistic (_f) based on its p-value (_p_d).
I am almost there, but apparently the 2 actions exclude each other. When I assign stars to _f based on _p_d, the program forgets about the previous assignment of stars to _r_b based on _r_p.
It would be really nice to be able to cumulate the 2 actions. I am sure this is possible, but I haven't figured out how to do it yet. Many thanks in advance for your help.
Best regards,
Matteo Filippi
Please consider the following table. I would like to assign stars to coefficients (_r_b) based on their p-values (_r_p), and to assign stars to the F statistic (_f) based on its p-value (_p_d).
Code:
clear all use https://www.stata-press.com/data/r17/nhanes2l collect clear collect _r_b _r_se, tag(model[(1)]): regress bpsystol weight i.diabetes i.sex collect _f=r(F) _p_d=r(p), tag(model[(1)]): testparm i.diabetes collect _r_b _r_se, tag(model[(2)]): regress bpsystol weight diabetes##sex collect _f=r(F) _p_d=r(p), tag(model[(2)]): testparm i.diabetes i.diabetes#i.sex collect layout (colname#result) (model) collect style showbase off collect style cell, nformat(%5.2f) collect style cell border_block, border(right, pattern(nil)) collect style cell result[_r_se], sformat("(%s)") collect style cell cell_type[item column-header], halign(center) collect style header result, level(hide) collect style column, extraspace(1) collect style row stack, spacer delimiter(" x ") collect layout (colname#result result[_f _p_d]) (model) collect style header result[_f _p_d], level(label) collect label levels result _f "F-statistic" _p_d "p-value", modify collect preview
Code:
collect stars _r_p 0.01 "***" 0.05 "**" 0.1 "*", attach(_r_b) collect preview collect stars _p_d 0.01 "***" 0.05 "**" 0.1 "*", attach(_f) collect preview
Best regards,
Matteo Filippi