1
$\begingroup$

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)?

$\endgroup$
1
$\begingroup$

If population=100,000, then num of events= 100 and non-events= (100,000-100)=99,900.

With sensitivity and specifiity being 99%, the confusion matrix for this problem will look like:

         Predicted
          1    0
Actual 1 TP   FN
       0 FP   TN

         Predicted
         1    0
Actual 1 99   1
       0 999 98,901

Hence, FP+TN will evaluate to 99,900. So I don't think the mistake is yours, the comment is incorrect

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy