Hi SAS experts,
I have a data set with N= 2196 observations, variables PIPE1, PIPE2, PIPE3, PIPE4, PIPE5, PIPE6, PIPE_Score, PIIE_Triage and an outcome variable (Outcome, values 0 for No and 1 for Yes). I need help with calculating the sensitivity and specificity for predicting the outcome based on the PIPE1 using a bootstrapping data. I calculated the sensitivity and specificity for the original data set but I need help with calculating the sensitivity and specificity for the bootstrapped dataset. How can I achieve this? Any help with this is much appreciated.
Thank you so much in advance!
SM
PROC IMPORT OUT= WORK.Flu
DATAFILE= "\\Desktop\Flu.xlsx"
DBMS=EXCEL REPLACE;
RANGE="Sheet1$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc freq data=Flu order=data;
tables Pipe1*Outcome / senspec;
run;
*Bootstrapping;
proc surveyselect data=flu NOPRINT seed=123456
out=fluBootout
method=urs
samprate=1
reps=1000;
run;
On top of the below program, please also take a look at :
https://blogs.sas.com/content/tag/bootstrap-and-resampling/
Here's the program (I have made my own dataset "Flu" in the first line of code) :
And maybe you want to reconsider your choice of "1" for samprate.
The procedure treats the value 1 as 100% instead of 1%.
If you want 1%, use SAMPRATE=0.01 .
data Flu; set sashelp.class; Pipe1=Sex; Outcome=Sex; run;
proc freq data=Flu order=data;
tables Pipe1*Outcome / senspec;
run;
*Bootstrapping;
proc surveyselect data=Flu NOPRINT seed=123456
out=fluBootout
method=urs
samprate=1
reps=1000;
run;
ods trace off;
ods exclude CrossTabFreqs;
ods output SenSpec=work.SenSpec;
proc freq data=fluBootout order=data;
by Replicate;
weight NumberHits;
tables Pipe1*Outcome / senspec;
run;
title; footnote;
title 'Bootstrapped Sensitivity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
where Statistic='Sensitivity';
var Estimate;
run;
title 'Bootstrapped Specificity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
where Statistic='Specificity';
var Estimate;
run;
title; footnote;
/* end of program */
Koen
On top of the below program, please also take a look at :
https://blogs.sas.com/content/tag/bootstrap-and-resampling/
Here's the program (I have made my own dataset "Flu" in the first line of code) :
And maybe you want to reconsider your choice of "1" for samprate.
The procedure treats the value 1 as 100% instead of 1%.
If you want 1%, use SAMPRATE=0.01 .
data Flu; set sashelp.class; Pipe1=Sex; Outcome=Sex; run;
proc freq data=Flu order=data;
tables Pipe1*Outcome / senspec;
run;
*Bootstrapping;
proc surveyselect data=Flu NOPRINT seed=123456
out=fluBootout
method=urs
samprate=1
reps=1000;
run;
ods trace off;
ods exclude CrossTabFreqs;
ods output SenSpec=work.SenSpec;
proc freq data=fluBootout order=data;
by Replicate;
weight NumberHits;
tables Pipe1*Outcome / senspec;
run;
title; footnote;
title 'Bootstrapped Sensitivity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
where Statistic='Sensitivity';
var Estimate;
run;
title 'Bootstrapped Specificity';
PROC MEANS data=work.SenSpec mean median stderr stddev;
where Statistic='Specificity';
var Estimate;
run;
title; footnote;
/* end of program */
Koen
@sms1891 wrote:
Can we get the 95% CIs for the bootstrapped sensitivity and specificity?
Of course, you can!
Look here and you will find out how to do so ...
Compute a bootstrap confidence interval in SAS
By Rick Wicklin on The DO Loop August 10, 2016
https://blogs.sas.com/content/iml/2016/08/10/bootstrap-confidence-interval-sas.html
Koen
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.