Hello Statalist users,
I am trying to draw a bland Altman plot with a shaded region between two defined upper and lower confidence interval lines. I am having trouble adding the shaded region into the graph. the code I am currently using is below (without any shading region code):
I have attached below what the outputted graph looks like. If anyone could help me find the code to add the shaded region into the defined horizontal confidence interval area that would be very helpful.
I look forward to your responses.
Annabelle
I am trying to draw a bland Altman plot with a shaded region between two defined upper and lower confidence interval lines. I am having trouble adding the shaded region into the graph. the code I am currently using is below (without any shading region code):
Code:
gen diff=NfLCap_P_0 - NfLCap_S_0 sum diff, d local diffmean : display %5.3f r(mean) local diffsd : display %5.3f r(sd) local upper = r(mean) + 1.96 * r(sd) local lower = r(mean) - 1.96 * r(sd) gen mean1=(NfLCap_P_0 + NfLCap_S_0)/2 twoway (scatter diff mean1 if disease_grp==0 , `scattercircle' mcolor("`INF_grey'")) /// (scatter diff mean1 if disease_grp==1 , `scattercircle' mcolor("`INF_Red_Light'")) /// (scatter diff mean1 if disease_grp==2 , `scattercircle' mcolor("`INF_Red'")), /// yline(0, lc("`INF_Blue'") lpattern(dot) lwidth(medium)) /// yline(`diffmean', lc("`INF_Blue_Light'") lwidth(medium)) /// yline(`upper', lc("`INF_Blue_Light'") lwidth(medium)) /// yline(`lower', lc("`INF_Blue_Light'") lwidth(medium)) /// legend(off) aspectratio(1) /// xlabel(0(20)80) xscale(range(0 80)) /// ylabel(-20(5)20) yscale(range(-20 20)) /// text(20 0 "Mean = `diffmean'", place(e)) text(18 0 "SD = `diffsd'", place(e)) /// ytitle("Difference, NfLCap_P_0 - NfLCap_S_0") xtitle("Mean, NfLCap_P_0 NfLCap_S_0") gr_edit .plotregion1.style.editstyle boxstyle(linestyle(color(none))) editcopy
I look forward to your responses.
Annabelle
Comment