Skip to content

Add Introduction to Bayesian Methods lecture (#751)#758

Merged
jstac merged 2 commits into
mainfrom
add-bayesian-methods-lecture
May 29, 2026
Merged

Add Introduction to Bayesian Methods lecture (#751)#758
jstac merged 2 commits into
mainfrom
add-bayesian-methods-lecture

Conversation

@jstac
Copy link
Copy Markdown
Contributor

@jstac jstac commented May 29, 2026

Closes #751.

Adds a new lecture, Introduction to Bayesian Methods, motivated by a microloan default-risk story (a development bank entering a new lending market).

The lecture builds up gradually for a relatively unsophisticated audience:

  • Conditional probability and a worked borrower-risk example
  • Bayes' law, derived and named (prior / likelihood / posterior)
  • The microloan setup: defaults as Bernoulli draws with unknown $\theta$, a beta prior
  • One-step update with the Bernoulli likelihood, computed numerically on a grid (trapezoidal rule), broken into a normalizing_constant helper and an update step
  • The beta closed form and conjugacy, validated against the numerics
  • Iterative (sequential) updating over a simulated stream of outcomes
  • The equivalent batch update via the binomial likelihood, with sequential ≡ batch shown algebraically and numerically
  • Loan pricing: expected loss = posterior mean, and the break-even interest rate $r = \theta/(1-\theta)$ under risk neutrality and zero profits
  • Two exercises (prior sensitivity; posterior mean + credible interval)

MCMC is deliberately left for a subsequent lecture.

Slotted under the Estimation part of _toc.yml, after mle.

All code cells were run end-to-end (including under -W error::DeprecationWarning); uses np.trapezoid and matplotlib default colors.

🤖 Generated with Claude Code

New lecture introducing Bayesian updating through a microloan default
example. Builds from conditional probability and Bayes' law to a
Bernoulli/beta conjugate model, covering:

- numerical grid-based posterior updating via the trapezoidal rule
- the beta closed form and conjugacy
- iterative (sequential) updating and the equivalent batch binomial update
- loan pricing: expected loss and the break-even interest rate r = θ/(1-θ)
- two exercises (prior sensitivity, credible interval)

Slotted under the Estimation part of the table of contents after mle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit 4e1e995
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a1a0152a5872200091f468f
😎 Deploy Preview https://deploy-preview-758--taupe-gaufre-c4e660.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

@github-actions github-actions Bot temporarily deployed to pull request May 29, 2026 07:28 Inactive
@github-actions github-actions Bot temporarily deployed to pull request May 29, 2026 07:29 Inactive
- Fix variable-name mismatches (y_outcomes/outcomes, current/current_vals)
  and define prior_vals at module scope
- Normalize each iterated posterior against the running density rather
  than the original prior
- Fix two prose typos
- Add a note explaining that sequential updating also relies on
  conditional independence, just implicitly
- Add a hidden-input figure visualizing the trapezoidal rule
- Rename the conditional-probability example label to bayes_ex_cond

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot temporarily deployed to pull request May 29, 2026 21:25 Inactive
@github-actions github-actions Bot temporarily deployed to pull request May 29, 2026 21:26 Inactive
@jstac jstac merged commit f0bd029 into main May 29, 2026
7 checks passed
@jstac jstac deleted the add-bayesian-methods-lecture branch May 29, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduction to Bayesian methods

1 participant