Introduction to Stata 8 - (GRIPS
Introduction to Stata 8 - (GRIPS
Introduction to Stata 8 - (GRIPS
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
twoway connected; twoway rcap<br />
100<br />
80<br />
Mean score<br />
60<br />
40<br />
20<br />
PF RP BP GH VT SF RE MH<br />
SF-36 subscale<br />
Observed<br />
Expected<br />
95% CI<br />
// c:\dokumenter\...\gph.SF36a.do<br />
clear<br />
input scale n obs sd norm<br />
1 139 60.81 27.35 70.77<br />
2 139 37.65 42.06 62.01<br />
...<br />
8 139 73.06 21.54 79.99<br />
end<br />
generate se=sd/sqrt(n)<br />
generate ci1=obs+1.96*se<br />
generate ci2=obs-1.96*se<br />
label define scale 1 "PF" 2 "RP" 3 "BP" 4 "GH" 5 "VT" 6 "SF" 7 "RE" 8 "MH"<br />
label values scale scale<br />
set scheme lean1<br />
twoway ///<br />
(connected obs scale , msymbol(O) clpattern(l)) ///<br />
(connected norm scale , msymbol(O) mfcolor(white) clpattern(-)) ///<br />
(rcap ci1 ci2 scale) ///<br />
, ///<br />
ytitle("Mean score") ///<br />
xtitle("SF-36 subscale") ///<br />
xlabel(1(1)8 , valuelabel noticks) ///<br />
xscale(range(0.5 8.5)) ///<br />
legend(label(1 "Observed") label(2 "Expected") label(3 "95% CI")) ///<br />
xsize(4) ysize(2.3) scale(1.4)<br />
This graph includes three plots; two connected and one rcap. In twoway plots both axes<br />
are continuous, so you could not have a categorical variable (PF, RP etc.) at the x-axis.<br />
Solution: use a numerical variable and use value labels <strong>to</strong> indicate the meaning. This graph<br />
style is frequently used <strong>to</strong> present SF-36 results, although connecting lines may be illogical<br />
when displaying eight qualitatively different scales.<br />
xscale(range(0.5 8.5)) increased the distance between plot symbols and plot margin.<br />
rcap does not calculate confidence intervals for you; it is up <strong>to</strong> you <strong>to</strong> provide two y- and<br />
one x-value for each confidence interval. rspike would have plotted intervals without caps.<br />
47