Can someone tell me how to plot relative risk and 95% CI in stata. I used the cs command to estimate these parameters but am having trouble plotting them. Thank you!
-
Login or Register
- Log in with
* Use example from this UCLA page: * https://stats.idre.ucla.edu/stata/faq/how-can-i-estimate-relative-risk-using-glm-for-common-outcomes-in-cohort-studies/ clear use https://stats.idre.ucla.edu/stat/stata/faq/eyestudy cs lenses carrot * return list generate Upper = r(ub_rr) // 95% CI upper bound generate Lower = r(lb_rr) // 95% CI lower bound generate RR = r(rr) // risk ratio (RR) generate byte Exposed = 1 // variable to use on X-axis of plot twoway rcap Upper Lower Exposed || scatter RR Exposed * Use -glm- to estimate RR, then use -coefplot- to plot it glm lenses i.carrot, fam(bin) link(log) nolog *coefplot, drop(_cons) yline(0) ytitle(ln(Risk Ratio)) vertical coefplot, drop(_cons) yline(1) ytitle(Risk Ratio) vertical eform
Comment