Neural Sync Active
Week 9: Bayesian Estimation
Registry Synced
Week 9: Bayesian Estimation
624 words
3 min read
Reading compass
Now · 1. Intuition: The Bayesian Philosophy
Week 9: Bayesian Estimation
Prerequisites: MLE (Week 7.2: Maximum Likelihood Estimation (MLE)), Conditional Distributions (Week 1.3: Conditional Distributions) Cross-links: BSMA3012 (Linear Stat Models) — Bayesian regression Core question: How do we incorporate prior knowledge into parameter estimation?
1. Intuition: The Bayesian Philosophy
The frequentist approach treats θ as an unknown but fixed constant. The Bayesian approach treats θ as a random variable with its own distribution.
Bayes' theorem for parameters:
- Prior π(θ): Your belief about θ before seeing data.
- Posterior π(θ∣x): Your updated belief after seeing data.
- Likelihood f(x∣θ): Same as in MLE.
2. The Bayesian Workflow
(Diagram)
3. Conjugate Priors
A prior is conjugate if the posterior belongs to the same family as the prior.
| Likelihood | Conjugate Prior | Posterior |
|---|---|---|
| Bernoulli( p ) | Beta( α,β ) | Beta( α+∑xi,β+n−∑xi ) |
| Poisson( λ ) | Gamma( α,β ) | Gamma( α+∑xi,β+n ) |
| Normal( μ , known σ2 ) | Normal( μ0,τ2 ) | Normal( 1/τ2+n/σ2μ0/τ2+nxˉ/σ2,1/τ2+n/σ21 ) |
| Normal(known μ , σ2 ) | Inverse-Gamma( α,β ) | Inverse-Gamma( α+n/2,β+21∑(xi−μ)2 ) |
| Exponential( λ ) | Gamma( α,β ) | Gamma( α+n,β+∑xi ) |
4. Worked Example: Bernoulli-Beta Conjugate
Model: Xi∼Bernoulli(p) i.i.d. Prior: p∼Beta(α,β) with PDF π(p)∝pα−1(1−p)β−1. Data: ∑xi successes in n trials.
Posterior:
So p∣x∼Beta(α+∑xi,β+n−∑xi).
Posterior mean (under squared error loss):
This is a weighted average of the prior mean α/(α+β) and the sample proportion xˉ.
Numerical Example
Suppose prior Beta(2,2) (prior mean 0.5). Observe n=10, ∑xi=7.
Posterior: Beta(9,5). Posterior mean: 149≈0.643. Sample proportion: 0.7. Prior mean: 0.5.
The posterior mean (0.643) is pulled towards the prior relative to 0.7.
5. Non-Informative Priors
When we have little prior information, we use non-informative (flat) priors:
- Uniform prior: π(θ)∝1 (improper if range unbounded)
- Jeffreys prior: π(θ)∝I(θ) (invariant to reparameterisation) With a flat prior, the posterior mode equals the MLE.
6. Bayesian vs Frequentist
| Aspect | Frequentist | Bayesian |
|---|---|---|
| θ | Fixed constant | Random variable |
| Inference | Based on sampling distribution | Based on posterior |
| Prior | Not used | Required |
| Interval | Confidence interval (random) | Credible interval (fixed given data) |
| Interpretation | 95% of intervals contain θ | 95% probability θ lies in interval |
7. Practice Questions
Q1 (Easy)
Prior: p∼Beta(1,1) (uniform). Data: 3 successes in 10 trials. Find posterior.
Full SolutionPosterior: Beta(1+3,1+7)=Beta(4,8). Posterior mean: 4/12=1/3≈0.333.
Q2 (Medium)
Prior: λ∼Gamma(2,1). Data: n=5, ∑xi=15. Find posterior for Poisson(λ).
Full SolutionPosterior: Gamma(2+15,1+5)=Gamma(17,6). Posterior mean: 17/6≈2.83.
Q3 (Hard — Normal-Normal)
Prior: μ∼N(0,4). Data: n=10, xˉ=2, known σ2=1. Find posterior.
Full SolutionPosterior precision: 1/τ2+n/σ2=1/4+10/1=10.25. Posterior mean: 10.250/4+10⋅2/1=10.2520≈1.951. Posterior variance: 1/10.25≈0.0976.So μ∣x∼N(1.951,0.0976).
Next topic: Week 10.1: Introduction to Hypothesis Testing — Introduction to Hypothesis Testing. Join Discord PreviousWeek 8.2: Confidence IntervalsNextWeek 10.1: Introduction to Hypothesis Testing