Chapter 2: simulation of positive result from a high-specificity diagnostic test
Chapter 2: simulation of positive result from a high-specificity diagnostic test
If you were a physician given a positive test result from :
REPS=42420; %[first 20 are hits, next 400 are FA, next 2000 are misses, and last 40000 are CR]
keepgoing=1;
while keepgoing, counter=0;
samp=randi(REPS); %select a person from among all those tested
while samp>420, samp=randi(REPS); counter=counter+1; end
% Construct a questdlg with three options
choice = questdlg({['All of your ' num2str(counter) ' previous patients have received negative results. Your current patient has a positive test. Is disease present?']},'', {'Yes','No','Cancel'});
% Handle response
switch choice
case 'Yes'
if samp<21, disp(['You''re right!! disease WAS present'])
else disp(['wrong!! no disease here']); end
case 'No'
if samp>20, disp(['You''re right!! no disease here'])
else disp(['wrong!! disease was present after all']); end
case 'Cancel'
keepgoing=0; end, end