What will I learn here?
The complete Bayes cycle for linear regression:
Prior β Likelihood β Posterior. You control the true
parameters
and the prior assumptions β and immediately see how both
shape the posterior.
The Model
Ξ± ~ N(ΞΌ_Ξ±, Ο_Ξ±) Β· Ξ² ~ N(ΞΌ_Ξ², Ο_Ξ²) Β· Ο ~ HalfNormal(s_Ο)
y ~ N(Ξ± + Ξ²Β·x, Ο) β the likelihood
Left sidebar:
true parameters (simulate the data) Β·
priors (your assumptions about Ξ±, Ξ², Ο)
The Five Panels
- Kruschke Diagram β generative model structure: Hyperpriors β Priors β Likelihood β Data
- Prior Predictive β what do regression lines look like before we see data? (McElreath Ch. 4)
- Prior vs. Posterior β how do the data shift our beliefs about the regression line?
- Marginal Distributions β Ξ±, Ξ², Ο: Prior β Posterior in direct comparison
- MCMC Sampler β joint sampling of (Ξ², Ο) with Metropolis-Hastings; heatmap + trace plots
CI vs. Prediction Interval
95% CI Mean (green, narrow): Uncertainty about the
location of the regression line β contains only parameter uncertainty.
95% PPI New Observation (dashed, wider): where will
a new data point fall? Also includes residual scatter Ο.
With small Ο the CI and PPI are close β with large Ο
the PPI is much wider.
Gaussian vs. Outlier-robust
Gaussian: y ~ N(Ξ± + Ξ²Β·x, Ο) β standard
Outliers: y ~ t(Ξ½, Ξ± + Ξ²Β·x, Ο) β heavier tails,
more robust against individual extreme values
Next β Bayesian PP Check:
Posterior Predictive Checks for model diagnostics