Learn R Programming

BayesianFROC (version 1.0.0)

CoronaVirus_Disease_2019_prevalence: Who should be inspected?

Description

Even if we test all people, the result is true with very low probabilties.

Usage

CoronaVirus_Disease_2019_prevalence(pre, se, sp)

Arguments

pre

Prevalence of population

se

Sensitivity of a diagnostic test

sp

Specificity of a diagnostic test

Value

same as CoronaVirus_Disease_2019()

$$Prob(Truth = diseased | Diagnosis = Positive) = \frac{Se\times pre}{Se \times pre + (1-pre)\times(1-sp)} $$

where we denotes the conditional probability measure of an event \(A\) given the assumed occurrence of \(G\) as an usual manner

$$P(A|G):= \frac{P(A \cap G)}{P(G)}. $$

Details

--------------------------------------------------------------------------

Diagnosis \ truth

Diseased Non-diseased -----------------------
----------------------- ------------- Positive se*n
\((N-n)(1-sp)\) Negative (1-se)*n \((N-n)sp\)
----------------------- ----------------------- -------------
n \(N-n\)

Diagnosis \ truth

Diseased

-------------------------------------------------------------------------

For example,

if prevalence is 0.0001,

population is 10000,

specificity = 0.8,

sensitivity = 0.9,

then the table is the following.

We can calculates the probability of the event that positive-diagnosis correctly detects the diseased patient is

$$ \frac{9}{1998 + 9} = 9/(1998+9) = 0.00448 $$

--------------------------------------------------------------------------

Diagnosis \ truth

Diseased Non-diseased -----------------------
----------------------- ------------- Positive 9
1998 Negative 1 7992
----------------------- ----------------------- -------------
\(n = 10\) \(N-n=10000-10\)

Diagnosis \ truth

Diseased

-------------------------------------------------------------------------

See Also

CoronaVirus_Disease_2019()

Examples

Run this code
# NOT RUN {
CoronaVirus_Disease_2019_prevalence(0.0001, 0.9,0.8)
CoronaVirus_Disease_2019_prevalence(0.03,0.9,0.8)
CoronaVirus_Disease_2019_prevalence(0.3,0.9,0.8)



#========================================================================================
#  If Sensitivity and Specificity is larger, then, the probability is also larger
#========================================================================================


x <- stats::runif(1111,0,1)
y <- CoronaVirus_Disease_2019_prevalence(0.1,x,x)

dark_theme(4)
plot(x,y)








x <- stats::runif(1111,0,1)
y <- CoronaVirus_Disease_2019_prevalence(0.01,x,x)

dark_theme(4)
plot(x,y)






x <- stats::runif(1111,0,1)
y <- CoronaVirus_Disease_2019_prevalence(0.001,x,x)

dark_theme(4)
plot(x,y)





#========================================================================================
#  linear case:
#
#   If prevalence is 0.5
#       and sensitivity = specificity
#   then, the probability is exactly same as sensitivity = specificity
#
#========================================================================================



x <- stats::runif(1111,0,1)
y <- CoronaVirus_Disease_2019_prevalence(0.5,x,x)

dark_theme(4)
plot(x,y)


sum(x==y)==length(x)

# Because the last is true, the probablity is same as sensitivity
# when the prevalence is 0.5.












#========================================================================================
#  If the prevalence is larger, then, the probability is also larger
#========================================================================================



x <- stats::runif(1111,0,1)
y <- CoronaVirus_Disease_2019_prevalence(x,0.9,0.9)

dark_theme(4)
plot(x,y)







# }

Run the code above in your browser using DataLab