ASTR 474 · Computational Astrophysics · Lecture 12

Lecture 12: Bayesian Inference for Astrophysical Models

How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

14-week course · 3 credits · Week 12

Motivation

How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

Bayes' rule combines likelihood and prior to produce a posterior. For binomial completeness data, a Beta prior gives a conjugate Beta posterior; posterior quantiles describe parameter uncertainty conditional on the assumed Bernoulli model and prior.

Today’s result must be interpretable as a physical statement with declared data, algorithm, uncertainty, and a check that could fail.

Learning objectives

After this lecture, you can

Core language

Terms for This Lecture

Prior

Definition: A probability distribution encoding parameter support and assumptions before conditioning on current data.

Why it matters here: It helps answer How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior? within the numerical model described here.

Relationships: Connect it to Posterior, the governing expression \(p(\theta\mid D)\propto p(D\mid\theta)p(\theta),\quad p\mid k,n\sim\mathrm{Beta}(k+\alpha,n-k+\beta)\), and the computed diagnostic developed later in the lecture.

Boundary or common confusion: A narrow posterior can still be wrong if the likelihood omits dependence, selection, calibration, or model discrepancy. Prior sensitivity should be tested when data are weak.

Physical and mathematical model

State what is being evolved

Bayes' rule combines likelihood and prior to produce a posterior. For binomial completeness data, a Beta prior gives a conjugate Beta posterior; posterior quantiles describe parameter uncertainty conditional on the assumed Bernoulli model and prior.

\[p(\theta\mid D)\propto p(D\mid\theta)p(\theta),\quad p\mid k,n\sim\mathrm{Beta}(k+\alpha,n-k+\beta)\]

Define the state, coordinates, units, initial/boundary conditions, and domain before interpreting solver output.

Numerical method

Algorithm choice is a modeling decision

Write the likelihood and prior; check support and identifiability; sample with an explicit generator seed; compare Monte Carlo quantiles to analytic conjugate summaries; separate posterior Monte Carlo error from scientific uncertainty.

  1. Write the model and its assumptions.
  2. Choose a solver and identify its stability, accuracy, and conservation properties.
  3. Record configuration, tolerances or timestep, and output sampling.
  4. Compare against an analytic limit, independent method, or controlled refinement.

Visual reasoning

Beta posterior for a binomial completeness measurement

Posterior distribution of completenessHistogram of 200000 seeded Beta posterior draws for 84 recovered injections out of 100, with central 68 percent interval marked. 84 / 100 recoveriescompleteness pposterior density
The interval is computed from seeded posterior draws of Beta(85,17), conditional on a uniform Beta(1,1) prior.

Computed example

One result, with a check

For k=84 of n=100 with a Beta(1,1) prior, 200,000 seeded Beta(85,17) draws give median 0.8356 and central 68% interval [0.7969, 0.8699].

Inputs and method are generated by src/astr474_computations.py; the machine-readable values are in data/generated/computed_results.json.

A narrow posterior can still be wrong if the likelihood omits dependence, selection, calibration, or model discrepancy. Prior sensitivity should be tested when data are weak.

Verification

What would falsify this result?

Do not report a smoother curve as proof of convergence.

Failure modes

Numerical agreement has a domain

A narrow posterior can still be wrong if the likelihood omits dependence, selection, calibration, or model discrepancy. Prior sensitivity should be tested when data are weak.

Solver error, discretization error, stochastic error, parameter uncertainty, and model discrepancy are different quantities. Diagnose and report them separately.

Active reasoning

Make a prediction before rerunning

How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

State a measurable outcome, a competing explanation, and the smallest computation that distinguishes them. Include an expected direction or scaling, then test it.

Workflow

From parameters to auditable output

Write the likelihood and prior; check support and identifiability; sample with an explicit generator seed; compare Monte Carlo quantiles to analytic conjugate summaries; separate posterior Monte Carlo error from scientific uncertainty.

Record the exact command, package versions, data path, random seed if applicable, and output checksum. Keep raw inputs unchanged and generated files separate.

Transfer

Lab and problem-set connection

Lab 06 estimates survey completeness with a Beta posterior and compares it with a plug-in binomial standard error.

Submit plots with labeled axes/units, a concise uncertainty argument, and enough code or intermediate values for a peer to reproduce the claim.

Synthesis

Three durable checks

  1. Does the implemented equation match the intended physical model?
  2. Does the numerical result converge under a controlled method change?
  3. Does the interpretation stay inside the validity and provenance limits?

A narrow posterior can still be wrong if the likelihood omits dependence, selection, calibration, or model discrepancy. Prior sensitivity should be tested when data are weak.

Sources

Technical references

Data and provenance details are recorded in reference-log.md. Last updated 2026-09-25.