Chapter 2: negative predictive value
This is simulated by sampling from all cases with negative results at the rate at which misses occur:
REPS=100000000;
HIT=[45 45 46 47]; %Hit data at each testing time
MISS=[5 5 4 3];
CR=[9027 9159 9237 9270];
FA=[923 791 713 680];
URNall=HIT+MISS+CR+FA; %size of urn containing all tests
URNhm=HIT+MISS; %urn containing all testees with disease
URNcf=CR+FA; %urn containing all testees without disease
for n=1:4,
Nlist=randi(URNall(n),[REPS 1])>(HIT(n)+FA(n)); %negative tests
Mlist=randi(CR(n)+MISS(n),[REPS 1])>CR(n); %Misses | neg test
pM(n)=sum(and(Nlist,Mlist))./sum(Nlist); end
disp(num2str(pM))