ASTR 474 · Lecture 12 · Study notes

Lecture 12: Bayesian Inference for Astrophysical Models — Lecture Notes

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

Terms Developed in Context

The terms below connect the mathematical model, implementation choices, computed diagnostics, and limits of the scientific claim.

Prior

A probability distribution encoding parameter support and assumptions before conditioning on current data. In this lecture it is used to address How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

Model connection: Read the term against Posterior and the governing relation \(p(\theta\mid D)\propto p(D\mid\theta)p(\theta),\quad p\mid k,n\sim\mathrm{Beta}(k+\alpha,n-k+\beta)\). The relevant computational evidence is a controlled output, residual, invariant, or refinement sequence rather than visual smoothness alone.

Interpretive limit: 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. This distinction separates numerical behavior from physical accuracy and model adequacy.

Posterior

The parameter distribution obtained by combining likelihood and prior through Bayes' rule. In this lecture it is used to address How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

Model connection: Read the term against Conjugate model and the governing relation \(p(\theta\mid D)\propto p(D\mid\theta)p(\theta),\quad p\mid k,n\sim\mathrm{Beta}(k+\alpha,n-k+\beta)\). The relevant computational evidence is a controlled output, residual, invariant, or refinement sequence rather than visual smoothness alone.

Interpretive limit: 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. This distinction separates numerical behavior from physical accuracy and model adequacy.

Conjugate model

A likelihood-prior pairing whose posterior remains in the same distribution family. In this lecture it is used to address How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

Model connection: Read the term against Credible interval and the governing relation \(p(\theta\mid D)\propto p(D\mid\theta)p(\theta),\quad p\mid k,n\sim\mathrm{Beta}(k+\alpha,n-k+\beta)\). The relevant computational evidence is a controlled output, residual, invariant, or refinement sequence rather than visual smoothness alone.

Interpretive limit: 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. This distinction separates numerical behavior from physical accuracy and model adequacy.

Credible interval

A posterior probability interval conditional on the adopted model and prior. In this lecture it is used to address How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

Model connection: Read the term against Posterior predictive check and the governing relation \(p(\theta\mid D)\propto p(D\mid\theta)p(\theta),\quad p\mid k,n\sim\mathrm{Beta}(k+\alpha,n-k+\beta)\). The relevant computational evidence is a controlled output, residual, invariant, or refinement sequence rather than visual smoothness alone.

Interpretive limit: 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. This distinction separates numerical behavior from physical accuracy and model adequacy.

Posterior predictive check

A comparison of replicated data drawn from the fitted model with observed diagnostic structure. In this lecture it is used to address How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?

Model connection: Read the term against Prior and the governing relation \(p(\theta\mid D)\propto p(D\mid\theta)p(\theta),\quad p\mid k,n\sim\mathrm{Beta}(k+\alpha,n-k+\beta)\). The relevant computational evidence is a controlled output, residual, invariant, or refinement sequence rather than visual smoothness alone.

Interpretive limit: 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. This distinction separates numerical behavior from physical accuracy and model adequacy.

Problem and physical meaning

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.

How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior? Begin from the scientific observable or state variable, and name what is directly specified versus inferred. The model should be simple enough to validate, but not quietly presented as the entire astrophysical system.

Model and derivation

The governing expression for this lecture is:

\[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 symbols and the independent variable before numerical evaluation. Dimensional analysis checks that both sides have matching units; if the model is dimensionless, state the adopted scale factors and the transformation back to physical units.

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.

Numerical implementation

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.

Keep physical quantities and numerical arrays conceptually separate. Convert units at well-defined boundaries, preserve raw inputs, and record dtype, solver, tolerances/timestep, grid, and software versions. A numerical method is part of the model evidence, not an invisible implementation detail.

Worked, programmatically computed example

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].

These values are generated in src/astr474_computations.py, then shared with lecture/lab/assignment renderers. Re-run the generator after changing an input; do not hand-edit a displayed result without recomputing dependent artifacts.

At least one independent check is required: an analytic solution, a second numerical method, a conservation law, or a controlled convergence sequence. When these disagree, diagnose units, frame, discretization, source terms, and model scope before selecting a result.

Error budget and limitations

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.

Classify each uncertainty before combining terms: local/global solver error, timestep or spatial discretization, Monte Carlo sampling, parameter uncertainty, measurement uncertainty, and model discrepancy are not interchangeable. Conservation can test internal consistency but does not prove the model is physically complete.

Connection to evidence and research practice

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

For real parameters, the source record distinguishes the fetched product and epoch from derived values. For synthetic experiments, the initial conditions, generator, seed, and exact file are recorded. A simulation is not an observation, even when its parameters resemble a real object.

Misconceptions to avoid

Study and review questions

  1. How do data, prior assumptions, and a finite Monte Carlo sample jointly shape a posterior?
  2. Which numerical parameter would you vary first, what observable would you track, and how would you know the sequence reached an asymptotic regime?
  3. Design one independent check and state what failure would change your scientific interpretation.

Preparation for the next lecture: explain how this method's assumptions change when the problem becomes more coupled, stochastic, or data-driven.

Lecture-specific derivation and assumptions

For k successes in n independent Bernoulli trials, the likelihood is proportional to p^k(1-p)^(n-k). A Beta(alpha,beta) prior is conjugate, yielding Beta(alpha+k,beta+n-k). With 84/100 and a uniform Beta(1,1) prior, the posterior is Beta(85,17). Its mean is a/(a+b), while posterior quantiles are not the same as a frequentist confidence interval. Monte Carlo quantile error is separate from posterior width.

Algorithm trace and computed-output interpretation

Draw 200,000 values from the seeded Beta(85,17) distribution, calculate the 0.16, 0.50, and 0.84 quantiles, then compare with deterministic Beta quantiles or an independently evaluated CDF. Repeat at larger draw counts to estimate Monte Carlo stability. Compare the posterior interval with the plug-in binomial standard error only as a rough scale check; also repeat with a scientifically motivated prior if completeness is weakly constrained.

Computed result: 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].

The posterior is conditional on independent, identically distributed injection outcomes, a constant completeness probability, and the selected prior. Correlated injections, covariate-dependent recovery, or selection effects require a different likelihood. A precise posterior does not include model discrepancy unless that uncertainty is explicitly modeled.

Two-meeting teaching arc

Each weekly module is taught in two 75-minute meetings. The sequence below includes a formative check in each meeting and is intended to use the lecture's worked computation, not merely present it.

  1. Meeting 1 (75 min): 10 min Bayesian framing; 20 min Bernoulli likelihood; 20 min conjugacy derivation; 20 min prior sensitivity; 5 min distinguish posterior mean from MLE.
  2. Meeting 2 (75 min): 10 min recap; 20 min seeded posterior sampling; 25 min compare Monte Carlo and analytic quantiles; 15 min inspect model assumptions; 5 min state what uncertainty is excluded.

Targeted study questions

  1. What posterior mean follows from Beta(85,17), and how does it differ from 84/100?
  2. How would a Beta(2,2) prior change the posterior parameters?
  3. Which injection design would test whether one constant p is adequate?

References and provenance: course reference log. Generated 2026-09-25.