Skip to content

Commit b50cd4a

Browse files
jstacclaude
andcommitted
Use p(θ) for density notation and break up solution derivation
- Change P(θ) to p(θ) throughout and note it is a density - Replace the single aligned equation block in the solution for part (b) with three separate display equations, each introduced by explanatory text (Bayes' Law, substitution, collecting powers) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3663efe commit b50cd4a

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

lectures/prob_meaning.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,14 @@ Instead, the probability distribution of $\theta$ is now a summary of our views
327327
* **before** we have seen **any** data at all, or
328328
* **before** we have seen **more** data, after we have seen **some** data
329329

330-
Thus, suppose that, before seeing any data, you have a personal prior probability distribution saying that
330+
Thus, suppose that, before seeing any data, you have a personal prior probability distribution with density
331331

332332
$$
333-
P(\theta) = \frac{\theta^{\alpha-1}(1-\theta)^{\beta -1}}{B(\alpha, \beta)}
333+
p(\theta) = \frac{\theta^{\alpha-1}(1-\theta)^{\beta -1}}{B(\alpha, \beta)}
334334
$$
335335

336-
where $B(\alpha, \beta)$ is a **beta function** , so that $P(\theta)$ is
337-
a **beta distribution** with parameters $\alpha, \beta$.
336+
where $B(\alpha, \beta)$ is a **beta function** , so that $p(\theta)$ is
337+
the density of a **beta distribution** with parameters $\alpha, \beta$.
338338

339339
We can update this prior after observing data using Bayes' Law (see {doc}`Probability with Matrices <prob_matrix>` for an introduction).
340340

@@ -344,10 +344,10 @@ $$
344344
L(k | \theta) = {n \choose k} \theta^k (1-\theta)^{n-k}
345345
$$
346346

347-
Applying Bayes' Law with our beta prior, the **posterior distribution** is
347+
Applying Bayes' Law with our beta prior, the **posterior density** is
348348

349349
$$
350-
\textrm{Prob}(\theta | k) = \frac{L(k | \theta) \cdot P(\theta)}{\int_0^1 L(k | \theta) \cdot P(\theta) \, d\theta} = \textrm{Beta}(\alpha + k, \, \beta + n - k)
350+
p(\theta | k) = \frac{L(k | \theta) \cdot p(\theta)}{\int_0^1 L(k | \theta) \cdot p(\theta) \, d\theta} = \textrm{Beta}(\alpha + k, \, \beta + n - k)
351351
$$
352352

353353
So the posterior is also a beta distribution — a consequence of the beta prior being **conjugate** to the binomial likelihood.
@@ -383,27 +383,28 @@ $$
383383
L(Y|\theta) = \theta^Y (1-\theta)^{1-Y}
384384
$$
385385

386-
**b)** The **posterior** distribution for $\theta$ after observing that single flip:
386+
**b)** By Bayes' Law, the posterior density for $\theta$ after observing a single flip $Y$ is
387387

388-
The prior distribution is
388+
$$
389+
p(\theta | Y) = \frac{L(Y | \theta) \cdot p(\theta)}{\int_{0}^{1} L(Y | \theta) \cdot p(\theta) \, d\theta}
390+
$$
391+
392+
Substituting the likelihood from (a) and the beta prior density, this becomes
389393

390394
$$
391-
\textrm{Prob}(\theta) = \frac{\theta^{\alpha - 1} (1 - \theta)^{\beta - 1}}{B(\alpha, \beta)}
395+
p(\theta | Y) = \frac{\theta^Y (1-\theta)^{1-Y} \cdot \theta^{\alpha - 1} (1 - \theta)^{\beta - 1} / B(\alpha, \beta)}{\int_{0}^{1} \theta^Y (1-\theta)^{1-Y} \cdot \theta^{\alpha - 1} (1 - \theta)^{\beta - 1} / B(\alpha, \beta) \, d\theta}
392396
$$
393397

394-
We can derive the posterior distribution for $\theta$ via
398+
Collecting powers of $\theta$ and $(1-\theta)$, we recognize the kernel of a beta density:
395399

396-
\begin{align*}
397-
\textrm{Prob}(\theta | Y) &= \frac{\textrm{Prob}(Y | \theta) \textrm{Prob}(\theta)}{\textrm{Prob}(Y)} \\
398-
&=\frac{\textrm{Prob}(Y | \theta) \textrm{Prob}(\theta)}{\int_{0}^{1} \textrm{Prob}(Y | \theta) \textrm{Prob}(\theta) d \theta }\\
399-
&= \frac{\theta^Y (1-\theta)^{1-Y}\frac{\theta^{\alpha - 1} (1 - \theta)^{\beta - 1}}{B(\alpha, \beta)}}{\int_{0}^{1}\theta^Y (1-\theta)^{1-Y}\frac{\theta^{\alpha - 1} (1 - \theta)^{\beta - 1}}{B(\alpha, \beta)} d \theta } \\
400-
&= \frac{ \theta^{Y+\alpha - 1} (1 - \theta)^{1-Y+\beta - 1}}{\int_{0}^{1}\theta^{Y+\alpha - 1} (1 - \theta)^{1-Y+\beta - 1} d \theta}
401-
\end{align*}
400+
$$
401+
p(\theta | Y) = \frac{\theta^{Y+\alpha - 1} (1 - \theta)^{1-Y+\beta - 1}}{\int_{0}^{1} \theta^{Y+\alpha - 1} (1 - \theta)^{1-Y+\beta - 1} \, d\theta}
402+
$$
402403

403404
which means that
404405

405406
$$
406-
\textrm{Prob}(\theta | Y) \sim \textrm{Beta}(\alpha + Y, \beta + (1-Y))
407+
\theta | Y \sim \textrm{Beta}(\alpha + Y, \, \beta + (1-Y))
407408
$$
408409

409410
**c)**

0 commit comments

Comments
 (0)