You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Polish Bayesian lecture and rename prob_dist title (#760)
- Add an overview flowchart (prior belief + data -> updated belief),
drawn inline with matplotlib in a hide-input cell
- Tighten prose around the prior and normalizing constant; define c(y)
explicitly and present the trapezoidal rule as a numbered list
- Fix a missing period and trailing whitespace
- Rename "Distributions and Probabilities" to "Common Distributions"
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
We will develop these ideas through an example drawn from development
27
62
finance: estimating the default rate on a new type of loan.
28
63
@@ -279,21 +314,29 @@ def pi(θ):
279
314
return beta.pdf(θ, a_0, b_0)
280
315
```
281
316
282
-
This prior puts most of its weight on default rates below 0.5, with a peak around 0.2, reflecting cautious optimism together with genuine uncertainty.
317
+
This prior was shown above.
318
+
319
+
It puts most of its weight on default rates below 0.5, with a peak around 0.2, reflecting cautious optimism (most borrowers don't default) together with significant uncertainty.
283
320
284
321
285
322
### Normalizing constant
286
323
287
-
Next we need to compute the integral in the denominator of {eq}`eq:bayes_density`.
324
+
Next we need to compute the constant in the denominator of {eq}`eq:bayes_density`,
325
+
which is the integrated likelihood times the prior:
326
+
327
+
$$
328
+
c(y) := \int_0^1 p(y \mid t)\, \pi(t)\, dt .
329
+
$$
288
330
289
-
One general approach is to compute it numerically, using a technique
290
-
such as the [trapezoidal rule](https://en.wikipedia.org/wiki/Trapezoidal_rule).
291
331
292
-
We fix a grid of points across $[0, 1]$ and represent each density by its values at those grid points.
332
+
One general approach is to compute $c(y)$ numerically, using a technique
333
+
such as the [trapezoidal rule](https://en.wikipedia.org/wiki/Trapezoidal_rule).
293
334
294
-
Every integral then becomes a sum that `numpy` can evaluate for us.
335
+
The idea of the trapezoidal rule is to
295
336
296
-
The idea of the trapezoidal rule is to join neighboring grid points by straight lines and sum the areas of the resulting trapezoids.
337
+
1. fix a grid of points across $[0, 1]$,
338
+
2. join neighboring grid points by straight lines, and
339
+
3. sum the areas of the resulting trapezoids.
297
340
298
341
The figure below illustrates this for the integrand $p(y \mid \theta)\, \pi(\theta)$ with $y = 1$, using a coarse grid so the trapezoids are visible.
0 commit comments