How can I plot a caterpillar plot using odd ratios

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
nabilshaaban
Posts: 2
Joined: Thu Dec 19, 2019 6:05 am

How can I plot a caterpillar plot using odd ratios

Post by nabilshaaban »

I would like to create a caterpillar plot (serrbar command) after performing a logistic multilevel model (two levels, level 1: patient, level 2: hospital)

I was able to run the caterpillar plot using the coefficient as follows:
xi: runmlwin depv indvars cons, ///
level2(hospital: cons, residuals(u)) level1(case_id:) discrete(distribution(binomial) link(logit) denominator(cons) pql2) nopause
egen pickone_hospital = tag(hospital)
qnorm u0 if pickone_hospital==1, aspectratio(1) scheme(s1mono)
egen u0rank = rank(u0) if pickone_school==1
serrbar u0 u0se u0rank if pickone_hospital==1, scale(1.96) yline(0) scheme(s1mono)

Now I need to run the serrbar using the odd ratio (and not the coefficients) and the 95% CI for the odds ratio.

thank you
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: How can I plot a caterpillar plot using odd ratios

Post by GeorgeLeckie »

Dear nabilshaaban,

You need to first create a dataset with the predicted odds ratio of each hospital and the the associated limits of the 95% CI.

Once you have done that you need to plot the results. You can do this with the twoway command and the scatter option for the point estiamates and the rcap option for the lower and upper limits of the 95% CI. You can't use the serrbar option to do this.

Best wishes

George
ievidently
Posts: 2
Joined: Sun Jan 19, 2020 8:31 am

Re: How can I plot a caterpillar plot using odd ratios

Post by ievidently »

Dear George,

Please can you provide extract of codes how to do this. Not sure to do this, also in the interested in getting the predicted odds ratio.

Thank you
ievidently
Posts: 2
Joined: Sun Jan 19, 2020 8:31 am

Re: How can I plot a caterpillar plot using odd ratios

Post by ievidently »

@nabilshaaban

Please, can show the final code you used in getting odd ratio (and not the coefficients) and the 95% CI for the odds ratio at level.

Thanks
ballgame
Posts: 1
Joined: Sun Sep 20, 2020 8:08 pm

Re: How can I plot a caterpillar plot using odd ratios

Post by ballgame »

you need to work with ratio to get those results.
Post Reply