diff --git a/10-Prediction.Rmd b/10-Prediction.Rmd index 57731f80..02927d74 100644 --- a/10-Prediction.Rmd +++ b/10-Prediction.Rmd @@ -251,6 +251,24 @@ $$ (\#eq:conditionalProbabilityRevised) $$ +We can then estimate the marginal probability of the event, substititing in $P(R | \text{not } C)$, using the law of total probability. +The [`petersenlab`](https://cran.r-project.org/web/packages/petersenlab/index.html) package [@R-petersenlab] contains the `pA()` function that estimates the marginal probability of one event, $A$. + +```{r, eval = FALSE, class.source = "fold-hide"} +pA <- function(pAgivenB, pB, pAgivenNotB){ + value <- (pAgivenB * pB) + pAgivenNotB * (1 - pB) + + value +} +``` + +```{r} +pA( + pAgivenB = .95, + pB = .003, + pAgivenNotB = .007171515) +``` + The [`petersenlab`](https://github.com/DevPsyLab/petersenlab) package [@R-petersenlab] contains the `pBgivenNotA()` function that estimates the probability of one event, $B$, given that another event, $A$, did not occur.\index{petersenlab package}\index{Bayesian!Bayes' theorem} ```{r, eval = FALSE, class.source = "fold-hide"}