I have problems understanding a basic quiz about sensitivity and specificity and, probably, with understanding of these basic concepts. The quiz goes:
"Suppose that we have created a machine learning algorithm that predicts whether a link will be clicked with 99% sensitivity and 99% specificity. The rate the link is clicked is 1/1000 of visits to a website. If we predict the link will be clicked on a specific visit, what is the probability it will actually be clicked?"
I am unable to understand the proposed solution because I do not understand one of its steps. The solution says:
*"Assume there are 100000 visits. That assumption is based on 1000 * 100 from 1/1000 rate given. What we are being asked is positive predictive value (PPV)..."*
Still ok with that, but then starts writing code
TP <- 99 FN <- 1 # population=100000 => FP+TN=99000 # specificity=99% => TN=0.99*99000=98901, therefore FP=999 TN <- 0.99 * 99900 FP <- 99900 - TN PPV <- TP / (TP + FP) PPV
I do not understand the comment row
# population=100000 => FP+TN=99000
for me FP+TN, false positives + true negatives, is "all the negatives" and, given that we are considering 100000 visits and the probability of positive (click on link) is 1 out of 1000 I would expect that the negatives would be 100000*0.999 = 99900, not the 99000 reported in the comment line
What is/are my mistake(s)?