Skip to contents

P(A|Z) = P(Z|A)P(A) / [P(Z|A)P(A) + P(Z|~A)P(~A)]. The defaults are the book's false-positive worked example: 2 percent prevalence, a 95 percent sensitive test, a 10 percent false-positive rate.

Usage

BayesExp(p_a = 0.02, p_z_given_a = 0.95, p_z_given_not_a = 0.1)

Arguments

p_a

prior P(A), in [0, 1].

p_z_given_a

likelihood P(Z | A), in [0, 1].

p_z_given_not_a

likelihood P(Z | not A), in [0, 1].

Value

list(posterior).

References

Morin, D. J. (2016). Probability: For the Enthusiastic Beginner. Createspace. Eqs. (2.52), (2.58)-(2.62).

Examples

BayesExp()$posterior
#> [1] 0.1623932