Week 4 Python Assessment :Fitting Statistical Models to Data with Python (Statistics with Python Specialization) Answers 2025
Question 1
What is the mean of the prior that we are using?
Answer: 100
Explanation: The prior mean used in this problem is the campus-average IQ prior, μ₀ = 100. ✅
Question 2
What is the standard deviation of the prior?
Answer: 10
Explanation: The prior standard deviation is σ₀ = 10. ✅
Question 3
If we observe a person with IQ = 110, which way does the posterior shift?
-
Left ❌
-
Right ✅
-
Stay the Same ❌
Explanation: The observed value (110) is larger than the prior mean (100), so the posterior mean shifts right (toward the observed data). The amount of shift depends on the relative precisions (inverse variances) of prior and data. ✅
Question 4
After observing three people with IQ=110 (new_data = [110,110,110]), how does the variance of my estimate change from my prior?
-
The variance decreases ✅
-
The variance increases ❌
-
The variance stays the same ❌
Explanation: Adding data increases information and reduces posterior uncertainty, so the posterior variance is smaller than the prior variance. ✅
Question 5
What is the posterior mean after observing three people with IQ = 110 (in a row)?
Answer: ≈ 109.7087 (rounded to 4 decimal places)
Explanation & calculation (numbers used):
Using a conjugate Normal–Normal update with prior mean μ₀ = 100, prior sd σ₀ = 10, known observation sd σ = 3, and n = 3 observations all equal to 110:
Posterior variance
σpost2=11/σ02+n/σ2=11/102+3/32\sigma_{post}^2 = \frac{1}{1/\sigma_0^2 + n/\sigma^2} = \frac{1}{1/10^2 + 3/3^2}σpost2=1/σ02+n/σ21=1/102+3/321
Posterior mean
μpost=(μ0σ02+nyˉσ2)σpost2\mu_{post} = \left(\frac{\mu_0}{\sigma_0^2} + \frac{n\bar{y}}{\sigma^2}\right)\sigma_{post}^2μpost=(σ02μ0+σ2nyˉ)σpost2
Plugging values gives μpost≈109.7087378641\mu_{post}\approx 109.7087378641μpost≈109.7087378641. ✅
Question 6
If I observe five people: [110,110,110,125,125], which statements are true?
Evaluate each option:
-
The posterior mean is the average of 110,110,110,125, and 125 — ❌
(the sample mean is 116, but the posterior mean is a precision-weighted combination of prior and data, not simply the raw sample mean) -
The posterior mean is equal to 110 — ❌
-
The posterior mean is equal to 100 — ❌
-
The posterior mean is equal to 125 — ❌
-
The posterior mean is equal to 115.717 — ✅
(Calculated posterior mean ≈ 115.7170923379 using μ₀=100, σ₀=10, σ=3, n=5, sample mean = 116.) -
The posterior standard deviation is the same as the prior standard deviation — ❌
-
The posterior standard deviation is greater than the prior standard deviation — ❌
-
The posterior standard deviation is less than the prior standard deviation — ✅
(posterior sd ≈ 1.3297, which is much smaller than prior sd = 10) -
The posterior standard deviation is equal to 10 — ❌
-
The posterior standard deviation is equal to 1.768 — ❌
(actual ≈ 1.3297) -
The posterior standard deviation is equal to 3 — ❌
Short numeric results used above:
-
Sample mean yˉ=(3⋅110+2⋅125)/5=116\bar{y} = (3\cdot110 + 2\cdot125)/5 = 116yˉ=(3⋅110+2⋅125)/5=116.
-
Posterior mean ≈ 115.7170923379.
-
Posterior standard deviation ≈ 1.3297266215. ✅
Explanation: With a relatively informative likelihood (σ = 3) and multiple observations, the posterior is pulled close to the data average but still slightly weighted toward the prior; uncertainty (posterior sd) decreases compared to the prior.
🧾 Summary Table
| Q# | Correct Answer (short) | Key concept |
|---|---|---|
| 1 | 100 |
Prior mean μ₀ |
| 2 | 10 |
Prior sd σ₀ |
| 3 | Right ✅ |
Observation > prior mean → posterior shifts toward data |
| 4 | Variance decreases ✅ |
More data ⇒ reduced posterior uncertainty |
| 5 | ≈ 109.7087 |
Posterior mean formula (precision-weighted) with μ₀=100, σ₀=10, σ=3, n=3 |
| 6 | Posterior mean ≈ 115.717 (✅), Posterior sd less than prior (✅) |
Precision-weighted update; posterior sd ≈ 1.3297 (μ₀=100, σ₀=10, σ=3, n=5, ȳ=116) |