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
How can I plot a caterpillar plot using odd ratios

 Posts: 2
 Joined: Thu Dec 19, 2019 6:05 am

 Site Admin
 Posts: 432
 Joined: Fri Apr 01, 2011 2:14 pm
Re: How can I plot a caterpillar plot using odd ratios
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
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

 Posts: 2
 Joined: Sun Jan 19, 2020 8:31 am
Re: How can I plot a caterpillar plot using odd ratios
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
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

 Posts: 2
 Joined: Sun Jan 19, 2020 8:31 am
Re: How can I plot a caterpillar plot using odd ratios
@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
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