Tip:
Highlight text to annotate it
X
And here's my code, this implements Bayes rule.
You take p0 a prior times a probability of seeing a positive test result
and divided by the sum of the same plus the expression for not having cancer,
which is the inverse prior and the inverse of this specificity is shown over here.
When I plug in my reference numbers, the ones from over here, I indeed get 0.33333.
So, this is the correct code and we can plug in our return numbers.
It's fun if we give it a zero probability prior to have cancer
and guess what, no matter what the test is, you still don't have cancer.
That's the beauty of Bayes' rule, it takes the prior very seriously.