- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How can I create a graph or chart to display sensitivity and specificity with 95% confidence intervals of multiple screening tests?
Name of Tests | Sn | Sp | Lower limit of 95% CI | Upper limit of 95% CI |
A | 60% | 70% | 0.45 | 0.98 |
B | 70% | 75% | 0.75 | 0.95 |
C | 80% | 80% | 0.82 | 1.00 |
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't recommend that graphic either, forest plots will definitely be nicer.
data have;
informat sn sp percent.;
infile cards dlm='09'x;
input group $ sn sp sn_ll sn_ul sp_ll sp_ul;
cards;
X 60% 70% 0.45 0.98 0.50 0.90
Y 70% 75% 0.35 0.95 0.40 0.90
Z 80% 80% 0.62 1.00 0.50 1.00
;;;;
run;
data long;
set have;
type = "Sensitivity";
value = sn;
ll = sn_ll;
ul = sn_ul;
output;
type = 'Specificity';
value = sp;
ll = sp_ll;
ul = sp_ul;
output;
drop sn: sp:;
run;
proc sgplot data=long;
vbarparm category=group response = value / limitlower=ll limitupper=ul group=type groupdisplay=cluster;
run;
proc sgplot data=long;
highlow x=group high=ul low = ll / group = type open =value groupdisplay = cluster;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What would such a chart look like? Can you point us to an example somewhere on the internet? Or draw it somehow and show us?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I should have added two more columns to the hypothetical table. I have revised the 95% CI values to make it more realistic.
Name of Tests | Sn | Sp |
Lower limit of 95% CI for Sn |
Upper limit of 95% CI for Sn |
Lower limit of 95% CI for Sp |
Upper limit of 95% CI for Sp |
X | 60% | 70% | 0.45 | 0.98 | 0.50 | 0.90 |
Y | 70% | 75% | 0.35 | 0.95 | 0.40 | 0.90 |
Z | 80% | 80% | 0.62 | 1.00 | 0.50 | 1.00 |
Please see the graph in the link, (1) graph with error bars - Bing images
Think, the red and blue bars as Sn and Sp, respectively. The lines as 95% CI. d16 as Test X, d20 as Test Y, and d21 as Test Z
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't think I'd do that as a bar chart. I might try a forest plot, basically a dot plot with intervals on each dot.
Here are a few graphing blogs from gurus at SAS that might help, with examples of bar charts and dot plots
https://blogs.sas.com/content/graphicallyspeaking/2017/10/22/tips-tricks-segmented-discrete-axis/
https://blogs.sas.com/content/graphicallyspeaking/2012/01/12/custom-confidence-intervals/
https://blogs.sas.com/content/iml/2011/10/07/creating-bar-charts-with-confidence-intervals.html
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't recommend that graphic either, forest plots will definitely be nicer.
data have;
informat sn sp percent.;
infile cards dlm='09'x;
input group $ sn sp sn_ll sn_ul sp_ll sp_ul;
cards;
X 60% 70% 0.45 0.98 0.50 0.90
Y 70% 75% 0.35 0.95 0.40 0.90
Z 80% 80% 0.62 1.00 0.50 1.00
;;;;
run;
data long;
set have;
type = "Sensitivity";
value = sn;
ll = sn_ll;
ul = sn_ul;
output;
type = 'Specificity';
value = sp;
ll = sp_ll;
ul = sp_ul;
output;
drop sn: sp:;
run;
proc sgplot data=long;
vbarparm category=group response = value / limitlower=ll limitupper=ul group=type groupdisplay=cluster;
run;
proc sgplot data=long;
highlow x=group high=ul low = ll / group = type open =value groupdisplay = cluster;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks so much! Is it possible to change color of the bars or lines for confidence intervals?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, take a look at the documentation for specifications or data attribute maps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
See discrete map example here:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n18szqcwir8q2nn10od9hhdh2ksj.htm
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sgplot data=long;
styleattrs datacolors=(cx9999ff cx993366);
vbarparm category=group response = value / limitlower=ll limitupper=ul group=type groupdisplay=cluster;
run;
Use STYLEATTRS but if you're missing a category you MUST use data attribute maps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content