Workflow & Model Building

Workflow & Model Building

This week we will cover a principled approach to Bayesian inference: explicitly detailing what you should be doing at every step of any problem. Then we will move on to the craft of building models, starting with linear models (which is where you should always start).

Practial Guide to Principled Bayesian Inference

Bayesian inference is not a single algorithm. It is a framework for learning from data—one that has been applied across astronomy for decades, but inconsistently, and with widely varying notation and terminology. This lecture will step you through how you should approach any problem, with a Bayesian view.

Fitting a Line to Data I: Least Squares and X-Uncertainties

We derive the connection between likelihood maximisation and chi-squared minimisation from first principles, develop the exact matrix solution for weighted least squares, and extend the likelihood to handle measurement uncertainty in the $x$-direction through marginalisation. This extension breaks the analytic solution and motivates the numerical methods in the next lecture.

Fitting a Line to Data II: Priors, MCMC, and Robust Fitting

We introduce prior probabilities for slope and intercept (including the rotation-invariant prior), then cover MAP estimation with scipy.optimize and MCMC sampling with emcee. We then push into realistic data complications: correlated measurement uncertainties handled by per-point covariance matrices, intrinsic scatter modelled as an additional variance term, and outliers treated via mixture models that assign continuous foreground probabilities rather than making binary outlier decisions.

Last updated on