Solution (source code)

= Solution

For data $D$, parameters $\theta$ and model $M$, <conditional probability> gives
$$
\boxed{p(\theta\mid D,M)=\frac{p(D\mid\theta,M)\,p(\theta\mid M)}{p(D\mid M)},\qquad p(D\mid M)=\int p(D\mid\theta,M)p(\theta\mid M)\,d\theta.}
$$
The <likelihood> describes the measurement process, the <prior> encodes parameter information before these data, and the <Bayesian evidence> normalizes the <posterior>. A <prior> is a <probability density> with respect to a specified measure; a uniform <prior> in distance is not uniform in parallax. <Bayes' theorem> combines <conditional probabilities> and does not itself select an appropriate <likelihood> or <prior>.

An astronomical application starts with a forward model. For measured fluxes $d_i$ with predictions $f_i(\theta)$ and known Gaussian covariance $C$, $L\propto|C|^{-1/2}\exp[-(d-f)^{\mathsf T}C^{-1}(d-f)/2]$. Correlated <calibration> errors belong in $C$ or in explicit <calibration> <nuisance parameters>; assuming every filter or epoch is independent can give falsely narrow uncertainties. For a faint photon-counting source, the more appropriate <likelihood> can instead be $p(N\mid s,b)=e^{-(s+b)}(s+b)^N/N!$, with nonnegative expected source and background counts. Background measurements constrain $b$, which is then marginalized rather than set to an exact subtracted number. The observed background-subtracted count can be negative even though the physical expected source count is nonnegative.

For a simple flux example with $d\mid F\sim\mathcal N(F,\sigma^2)$ and a Gaussian <calibration> <prior> $F\sim\mathcal N(F_0,\sigma_0^2)$, completing the square gives
$$
\sigma_p^{-2}=\sigma^{-2}+\sigma_0^{-2},\qquad F_p=\sigma_p^2\left(\frac d{\sigma^2}+\frac{F_0}{\sigma_0^2}\right).
$$
This explicitly shows how independent information combines. A physical nonnegative-flux <prior> would truncate or replace that illustrative Gaussian <prior>. Photometric-redshift fitting similarly compares predicted <galaxy> colours with measured fluxes, then integrates over <luminosity>, dust and other <nuisance parameters> to obtain $p(z\mid D)$. Multimodal <posteriors> should be retained when different spectral features produce similar colours; a best fit alone hides that ambiguity. The same framework applies to orbit parameters, stellar <temperatures>, cosmological parameters and cluster SZ amplitudes.

<credible intervals> state <posterior> <probability> conditional on the model and <prior>. <posterior predictive checks> compare replicated observations with the data and can reveal a deficient noise or source model. Sensitivity to plausible <priors> is especially important for weak signals and inverse problems. For competing models, <posterior> odds equal <prior> odds times the <Bayes factor> $Z_1/Z_2$; the evidence averages fit quality over the <prior> volume and therefore depends on proper, physically justified <prior> ranges. Detection thresholds and catalogue selection must enter the sampling model when inferring a population, otherwise a carefully calculated <posterior> can still describe a biased sample. \b[The practical gain is a joint uncertainty distribution with <nuisance parameters> propagated, not merely a single fitted number.]