All about Stanford University graduate course Physics 366, Winter 2023 edition.

This course covers the foundations of principled inference from data, primarily in the Bayesian framework, organized around applications in astrophysics and cosmology. Topics include probabilistic modeling of data, parameter constraints and model comparison, numerical methods including Markov Chain Monte Carlo, and connections to frequentist and machine learning frameworks. The course is organized around tutorials that provide hands-on experience with real data.

The class was developed for and is aimed at beginning graduate students in astrophysics and cosmology, and we strongly encourage most first and second year students working in KIPAC to take it when offered (normally every 2 years). However, the course materials are provided here for anyone who might want to learn (see the recommended prerequisites). Therefore, the usual syllabus information is split into two parts:

- An overview of the course for everyone
- Information, logistics and policies specifically for enrolled students

Our aim is to provide students with a foundation of experience in

- the reasoning that underlies principled inference from data,
- the algorithms and approximations employed for inference, and
- the strategies involved in solving realistically complex inference problems using real data.

You can find these spelled out in more detail in the overview.

**Start by looking at the Overview to understand how this course works, and Getting Started to get up and running with Python and Jupyter, if needed.**
Enrolled students should also read the Syllabus page to see what is expected.

The course content can be browsed here in static HTML format through the hyperlinks below. This is sufficient for the notes, but to do the tutorials you will need to download them in Jupyter notebook format. Enrolled students can most easily get them from Canvas, while others can download them from the GitHub repository. (We don't recommend a full clone, as the GitHub repo is extremely bloated, but you can simply either download individual files, or a full image of the current commit.)

A natural progression through the course notes and tutorials is depicted below. If you know the name of the notebook you're looking for, it may be faster to find it in the table farther below, which is also in a reasonable order.

flowchart TB classDef tutorial fill:#ffcccc, stroke:#f00; classDef opttutorial fill:#ffeeee; subgraph header [" "] subgraph Legend [Legend] direction LR N[Notes] --> T{{Core Tutorial}}:::tutorial N --> OT([Optional Tutorial]):::opttutorial end subgraph Logistics [Logistics] direction LR Noverview[Overview] Noverview --> Nsyllabus[Syllabus] Noverview --> Nsetup[Getting Started] Nsetup --> Tdemo([Demo]):::opttutorial end end style header fill:#fff,stroke:#fff Logistics ==> Principles subgraph Principles [Principles] direction LR Ngenmod[Generative Models] Nprobability[Essential Probability] Ngenmod --> Tgenmod{{Generative Models}}:::tutorial Nprobability --> Tprob{{Essential Probability}}:::tutorial Nprobability --> Tprobtrans([Probability Transformations]):::opttutorial Tprob --> Tsamples{{Working with Samples}}:::tutorial Ngenmod & Nprobability --> Nbayes[Bayes' Law] Nbayes --> Ncred[Credible Regions] & Nerrorbars[''Error Bars''] & Nfreq[Frequentism] & Nmodeval1[Model Evaluation and Comparison I] Nbayes --> Tbayes{{Bayes' Law}}:::tutorial Ncred --> Tcred{{Credible Regions}}:::tutorial Nfreq & Nerrorbars --> Tgauss([Gaussians and Least Squares]):::opttutorial Nfreq & Ncred --> Tfreq([Frequentism and Maximum Likelihood]):::opttutorial Ncred & Nmodeval1 --> Tgrid{{Toy Photometry /

On a Grid}}:::tutorial end Principles ==> Methods subgraph Methods [Methods] direction LR Nsampling[Monte Carlo Sampling] subgraph WorkhorseSamplers [Core: at least one] Tgibbs([Toy Photometry /

Gibbs Sampling]):::opttutorial Tmetro([Toy Photometry /

Metropolis Sampling]):::opttutorial end style WorkhorseSamplers fill: #ffcccc,stroke:#ff0000 Nsampling --> Tgibbs & Tmetro Nsampling --> Ndiagnostics[MCMC Diagnostics] & Nmoresampling[More Sampling Methods] Ndiagnostics & Tgibbs & Tmetro --> Tdiagnostics{{MCMC diagnostics}}:::tutorial Nmoresampling --> Npackages[MC Packages] Npackages & Tdiagnostics --> Tmulens{{Microlensing /

More Samplers}}:::tutorial Nsampling --> Nmodeval[Model Evaluation and Comparison II] Nmodeval --> Tmodeval{{Cluster Centering /

Model Evaluation}}:::tutorial Tmodeval --> Tmodcomp{{Cluster Centering /

Model Comparison}}:::tutorial end Methods ==> Practice subgraph Practice [Practice] direction LR Nhier[Hierarchical Models] Nhier --> Nmissing[Missing Data and

Selection Effects] & Nmodfree[''Model-free'' Models] & Napprox[Approximate Methods] & Nfish[How to Avoid

Fooling Ourselves] subgraph ToughProblems [Core: at least one] direction LR Tcephone([Period-Luminosity Relation /

One Galaxy]):::opttutorial Txmm2([X-ray Photometry]):::opttutorial Tcephall([Period-Luminosity Relation /

Multiple Galaxies]):::opttutorial Tvdisp([Cluster Membership /

Mixture Models]):::opttutorial Tmissing([O-ring Failures /

Missing Data]):::opttutorial Tnew((Design Your Own)):::opttutorial end style ToughProblems fill: #ffcccc,stroke:#ff0000 Nhier --> ToughProblems Nmissing --> Tmissing Nmodfree --> Tvdisp Tcepheids([Cepheid Data Intro]):::opttutorial --> Tcephone & Tcephall Txmm([XMM Image Intro]):::opttutorial --> Txmm2 end click Noverview "notes/overview.html" "Overview" click Nsyllabus "notes/syllabus.html" "Syllabus" click Nsetup "notes/getting_started.html" "Getting Started" click Tdemo "tutorials/demo.html" "Demo" click Ngenmod "notes/generative_models.html" "Generative Models" click Nprobability "notes/essential_probability.html" "Essential Probability" click Tgenmod "tutorials/generative_models.html" "Generative Models" click Tprob "tutorials/essential_probability.html" "Essential Probability" click Tprobtrans "tutorials/probability_transformations.html" "Probability Transformations" click Tsamples "tutorials/working_with_samples.html" "Working with Samples" click Nbayes "notes/bayes_law.html" "Bayes' Law" click Ncred "notes/credible_regions.html" "Credible Regions" click Nerrorbars "notes/errorbars.html" "Error Bars" click Nfreq "notes/frequentism.html" "Frequentism" click Nmodeval1 "notes/goodness.html" "Model Evaluation/Comparison I" click Tbayes "tutorials/bayes_law.html" "Bayes' Law" click Tfreq "tutorials/frequentism.html" "Frequentism" click Txmm "tutorials/xmm_image.html" "XMM" click Tcred "tutorials/credible_regions.html" "Credible Regions" click Tgauss "tutorials/gaussians.html" "Gaussians" click Tgrid "tutorials/toy_photometry_grid.html" "Photometry - grid" click Nsampling "notes/montecarlo.html" "Monte Carlo Sampling" click Tgibbs "tutorials/toy_photometry_gibbs.html" "Photometry - Gibbs" click Tmetro "tutorials/toy_photometry_metro.html" "Photometry - Metropolis" click Ndiagnostics "notes/mcmc_diagnostics.html" "MCMC Diagnostics" click Nmoresampling "notes/more_samplers.html" "More Samplers" click Npackages "notes/MC_packages.html" "MC Packages" click Tdiagnostics "tutorials/mcmc_diagnostics.html" "MCMC Diagnostics" click Tmoresampling "tutorials/more_samplers.html" "Some Other Sampler" click Togle "tutorials/ogle_lightcurve.html" "OGLE" click Tmulens "tutorials/microlensing.html" "Microlensing" click Nhier "notes/hierarchical.html" "Hierarchical Models" click Tcepheids "tutorials/cepheids.html" "Cepheids" click Tcephone "tutorials/cepheids_one_galaxy.html" "Cepheids - One Galaxy" click Tcephall "tutorials/cepheids_all_galaxies.html" "Cepheids - Multiple Galaxies" click Nmodeval "notes/model_evaluation.html" "Model Evaluation/Comparison II" click Tmodeval "tutorials/model_evaluation.html" "Model Evaluation" click Tmodcomp "tutorials/model_comparison.html" "Model Comparison" click Nmissing "notes/missingdata.html" "Missing Data" click Tmissing "tutorials/missing_data.html" "Missing Data" click Nmodfree "notes/modelfreemodels.html" "Model-free Models" click Napprox "notes/approximate_methods.html" "Approximate Methods" click Nfish "notes/fishing.html" "Foolishness" click Tvdisp "tutorials/cl_membership.html" "Cluster Membership" click Txmm2 "tutorials/xmm_cluster.html" "XMM Image" click Tnew "tutorials/your_own.html" "Design Your Own"

Notes | Core Tutorials | Optional Tutorials |
---|---|---|

Overview | ||

Syllabus (for enrolled students) | ||

Getting Started | Demo (ungraded) | |

Essential Probability | Essential Probability | Probability Transformations |

Working with Samples | ||

Generative Models | Generative Models | |

Bayes' Law | Bayes' Law | |

Credible Regions | Credible Regions | |

"Error Bars" | Gaussians and Least Squares | |

Model Evaluation and Comparison I | Toy Photometry/On a Grid | |

Frequentism | Frequentism |

Notes | Core Tutorials | Optional Tutorials |
---|---|---|

Monte Carlo Sampling | At least one optional $\rightarrow$ | Toy Photometry/Gibbs Sampling |

Toy/Photometry/Metropolis Sampling | ||

MCMC Diagnostics | MCMC Diagnostics | |

More Sampling Methods, MC packages | Microlensing/More Samplers | |

Model Evaluation and Comparison II | Cluster Centering/Model Evaluation | |

Cluster Centering/Model Comparison |

Notes | Core Tutorials | Optional Tutorials |
---|---|---|

Hierarchical Models | At least one optional (any row) | Design Your Own! |

Period-Luminosity Relation/One Galaxy (Cepheid Data Intro) | ||

Period-Luminosity Relation/Multiple Galaxies (Cepheid Data Intro) | ||

X-ray Photometry (XMM Image Intro) | ||

Missing Data and Selection Effects | O-Ring Failures/Missing Data | |

"Model-free" Models | Cluster Membership/Mixture Models | |

Approximate Methods | ||

How to Avoid Fooling Ourselves |

Solutions to the tutorials are **not** provided. However, there are static pages showing the outputs of correctly solved tutorials that you can compare your work to. Keep in mind that your results may not look *identical*, since many algorithms we use invoke random number generators.

We firmly believe that any website that cannot function without Javascript is not a website. Every page linked here should be basically functional without scripts. However, we do use Javascript in two way that are actually helpful:

Unless otherwise noted, all materials are Copyright 2015, 2017, 2019, 2021, 2023 by the contributors (below), and licensed under the Creative Commons CC BY-NC (Attribution-NonCommercial) 4.0 International License. Executable code is additionally covered by the BSD 3-Clause License.

Contributors:

- 2023: Adam Mantz
- 2021: Adam Mantz, Claire Hébert
- 2019: Adam Mantz, Phil Marshall
- 2017: Adam Mantz, Phil Marshall
- 2015: Phil Marshall, Adam Mantz, Elisabeth Krause, Matthew Becker, Eric Charles

Please report broken links and similar in the GitHub issues.