
I will assume readers’ awareness of the basics to an extent that readers know what keywords to search for. I will lay out necessary mathematics / computer science knowledge in this page, such that readers can focus on how to apply these math/CS knowledge to think about cognition when reading the note:
Case study: estimating the bias $\theta$ of a coin (p. 78)
Def. Conjugate priors
| Prior | Likelihood | Posterior |
|---|---|---|
| Beta | Bernoulli/Binomial | Beta |
| Normal | Normal | Normal |
| Gamma | Poisson | Gamma |
| Inverse Gamma | Normal Variance Estimation | Inverse Gamma |
Single draw
$f_X(x) = { x^{\alpha-1} (1-x)^{\beta-1} \over B(\alpha,\beta) }$
Prefer the (mean, precision) formulation.

Multiple draws
Three equivalant formulations:
They are different from “For i from 1 to n, draw $p_i \sim Beta(\alpha, \beta)$, then $Y_i \sim Bernoulli(p_i)$”. This is just $Y \sim Bin(n, \alpha / (\alpha + \beta))$ because trials are independent.
Why [2] = [3]: $Pr_2(Y_i=H \mid history) = E[p_i \mid history] = \alpha_i / (\alpha_i + \beta_i)$
Why [1] = [2]:
$$ \begin{aligned} &Pr_1(Y_i=H \mid history) \\&= \int Pr_1(Y_i=H \mid p,history) \pi(p \mid history) dp \\&= E[Pr(Y_i=H \mid p,history) \mid history] = E[p \mid history].\end{aligned} $$