View source: R/screening_test.R
screening_test | R Documentation |
Consider a screening test for a certain disease or condition, applied to a person who has a certain prior, pre-test probability of having the disease. For such a person this function calculates the probabilities that: the person has the disease given that they test positive; the person does not have the disease given that they test negative.
screening_test(prior, sensitivity, specificity)
prior |
A numeric scalar. The pre-test probability |
sensitivity |
A numeric scalar. The conditional probability that a
person who has the disease tests positive. If |
specificity |
A numeric scalar. The conditional probability that a
person who does not have the disease tests negative. If |
The required probabilities are calculated using the law of total probability
P(+) = P(+ \mid D) P(D) + P(+ \mid {\rm not}D) P({\rm not}D)
and Bayes' theorem
P(D \mid +) = \frac{P(+ \mid D) P(D)}{P(+)}
P({\rm not}D \mid -) = \frac{P(- \mid {\rm not}D) P({\rm not}D)}{P(-)}.
A list containing the following components
pp
The probability P(+)
that the person will test positive.
ppv
The positive predictive value. The conditional probability
P(D \mid +)
if the person tests positive then they has the disease.
npv
The negative predictive value. The conditional probability
P({\rm not}D \mid -)
if the person tests negative
then they do not have the disease.
prior
,sensitivity
,specificity
The input values of prior
,
sensitivity
and specificity
.
screening_test(prior = 0.1, sensitivity = 0.9, specificity = 0.9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.