Hi. Great posting. I've read numerous articles where MDs are asked to use info about specificity, sensitivity, and prevalence to make a statement about whether a person has or does not have a particular condition. Wonderful summary (a bit disheartening) at https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4521525/ A while ago, after reading all types of articles by MDs about COVID testing, I used SAS/GRAPH (GPLOT) to produce the charts shown here. As stated in your posting, prevalence makes a difference and I think that these charts might add a bit to the wonderful info you provided. RULE: as prevalence increases, it's better to believe a positive test than a negative test SAS code used shown below (I used a data step to produce the plot data, not a SAS PROC). data x;
input sens spec;
datalines;
.95 .95
.70 .95
;
data y;
set x;
do prev = .05 to 0.95 by .05;
p_real = 10000 * prev;
n_real = 10000 - p_real;
pr_pt = sens * p_real;
nr_nt = spec * n_real;
pr_nt = p_real - pr_pt;
nr_pt = n_real - nr_nt;
p_test = pr_pt + nr_pt;
n_test = pr_nt + nr_nt;
pvpos = round(100 * pr_pt / p_test,.1);
pvneg = round(100 * nr_nt / n_test,.1);
output;
end;
run;
goptions reset=all gunit=pct ftext="arial" htext=2pct border;
symbol1 i=j f='wingdings' v='6e'x h=3 c=red w=3;
symbol2 i=j f='wingdings' v='6c'x h=3 c=blue w=3;
axis1 label=(a=90 "PREDICTIVE VALUE OF TEST");
axis2 label=("PREVALENCE") order=(0.0 to 1.0 by 0.1) value=(h=2.0) minor=(n=1);
legend1 position=(BOTTOM inside CENTER) label=none offset=(3,) mode=share across=1
value=(j=c c=red 'POSITIVE' c=blue ' NEGATIVE') shape=symbol(.0001,3);
* choose a title1 based on sensitivity value;
title1 h=2.5 ls=2 "SENSITIVITY: 0.70 / SPECIFICITY: 0.95"; *title1 h=2.5 ls=5 "SENSITIVITY: 0.95 / SPECIFICITY: 0.70"; title2 a=90 ls=2;
title4 a=270 ls=2;
footnote1 ls=2;
proc gplot data = y; * use a WHERE statement to select data with sensitivity that matches plot title;
where sens = .70;
plot (pvpos pvneg) * prev / overlay vaxis=axis haxis=axis2 noframe legend=legend1;
run;
quit;
... View more