Dear Stata List members,
I'm trying to show the distribution of BMI among "admitted" patients (my entire sample) using histograms. My Y-axis is PERCENTAGE, not frequency. Now, I'm asked to highlight the portion of each bar with a different color to indicate, how much of the each bar represent "intubated:yes" patients; in other words, % of "intubated:yes" among the "admitted" for each BMI interval shown on the histogram. Say, for example, in the BMI interval 10-15 kg/m2, the y-axis is showing that 10% of the entire "admitted" patients fall into that interval; now , say, for example, only half of that bar represent "intubated". How can I show this?
I could show this if the Y-axis was FREQUENCY, not PERCENTAGE (please see the attached: "sample".gph); but they want % on the y-axis; with % y-axis, the intubation % should be calculated as follows: # of intubation:Yes, divided by the total # of "admitted", NOT the total number of "intubated". I tried to use the following code:
twoway (hist bmi, width(5) start(10) percent lcolor(gs12) fcolor(gs12%40)) ///
(hist bmi if intubation1==1, width(5) start(10) percent fcolor(eltblue%40) lcolor(eltblue)), ///
ytitle("") yscale(range(0 35)) yscale(noline) ylabel(0(5)35, labsize(small) noticks) ytitle(, size(small)) yscale(titlegap(2)) ///
xtitle("") xscale(range(0 70)) xscale(noline) xlabel(0(5)70, labsize(small) noticks) xmtick(##1) xtitle(, size(small)) xscale(titlegap(2)) ///
legend(row(1) size(small) label(1 "Admitted") label(2 "Intubated")) ///
scheme(s2gmanual) graphregion(fcolor(white) ifcolor(white))
But I ended up having the 2nd attachment ("unwanted".gph) where" intubation:yes" bars came up being taller than "admitted" bars since the denominator of the "% intubated: yes" was total # of "intubated", not the total number of "admitted". How can this be done? would greatly appreciate your suggestions. Thanks very much!
Sincerely
Musarray
I'm trying to show the distribution of BMI among "admitted" patients (my entire sample) using histograms. My Y-axis is PERCENTAGE, not frequency. Now, I'm asked to highlight the portion of each bar with a different color to indicate, how much of the each bar represent "intubated:yes" patients; in other words, % of "intubated:yes" among the "admitted" for each BMI interval shown on the histogram. Say, for example, in the BMI interval 10-15 kg/m2, the y-axis is showing that 10% of the entire "admitted" patients fall into that interval; now , say, for example, only half of that bar represent "intubated". How can I show this?
I could show this if the Y-axis was FREQUENCY, not PERCENTAGE (please see the attached: "sample".gph); but they want % on the y-axis; with % y-axis, the intubation % should be calculated as follows: # of intubation:Yes, divided by the total # of "admitted", NOT the total number of "intubated". I tried to use the following code:
twoway (hist bmi, width(5) start(10) percent lcolor(gs12) fcolor(gs12%40)) ///
(hist bmi if intubation1==1, width(5) start(10) percent fcolor(eltblue%40) lcolor(eltblue)), ///
ytitle("") yscale(range(0 35)) yscale(noline) ylabel(0(5)35, labsize(small) noticks) ytitle(, size(small)) yscale(titlegap(2)) ///
xtitle("") xscale(range(0 70)) xscale(noline) xlabel(0(5)70, labsize(small) noticks) xmtick(##1) xtitle(, size(small)) xscale(titlegap(2)) ///
legend(row(1) size(small) label(1 "Admitted") label(2 "Intubated")) ///
scheme(s2gmanual) graphregion(fcolor(white) ifcolor(white))
But I ended up having the 2nd attachment ("unwanted".gph) where" intubation:yes" bars came up being taller than "admitted" bars since the denominator of the "% intubated: yes" was total # of "intubated", not the total number of "admitted". How can this be done? would greatly appreciate your suggestions. Thanks very much!
Sincerely
Musarray