Chapter 3

One-Parameter Models

One-parameter models provide the cleanest laboratory for mastering the mechanics of Bayesian inference: sufficient statistics, conjugate updating by kernel recognition, posterior predictive distributions, credible intervals, and the unifying theory of exponential families.Peter D. Hoff. A First Course in Bayesian Statistical Methods. Springer Texts in Statistics. Springer, New York, 2009. ISBN 978-0-387-92299-7. doi: 10.1007/978-0-387-92407-6

3.1The Binomial–Beta Model

Let Y1,…,Yn∣θ∼i.i.d.binary⁡(θ)Y_1, \dots, Y_n \mid \theta \stackrel{\text{i.i.d.}}{\sim} \operatorname{binary}(\theta), where θ∈[0,1]\theta \in [0, 1] is a population proportion (for instance, the fraction of women aged 65+ in the 1998 GSS reporting general happiness: n=129n = 129, ∑yi=118\sum y_i = 118). The joint sampling probability is

p(y1,…,yn∣θ)=θ∑i=1nyi(1−θ)n−∑i=1nyi. p(y_1, \dots, y_n \mid \theta) = \theta^{\sum_{i=1}^n y_i}(1 - \theta)^{n - \sum_{i=1}^n y_i}. (3.1)

By the Fisher–Neyman factorization theorem, a statistic T(Y)T(Y) is a sufficient statistic for θ\theta if and only if the sampling density factors as p(y∣θ)=h(y) g(T(y),θ)p(y \mid \theta) = h(y)\,g\bigl(T(y), \theta\bigr) where h(y)h(y) does not depend on θ\theta. In (3.1), h(y)=1h(y) = 1 and the likelihood depends on (y1,…,yn)(y_1, \dots, y_n) only through Y=∑i=1nYiY = \sum_{i=1}^n Y_i; consequently, for any prior p(θ)p(\theta), the posterior p(θ∣y1,…,yn)=p(θ∣Y=y)p(\theta \mid y_1, \dots, y_n) = p(\theta \mid Y = y) is identical whether we condition on the full sequence or only on the sufficient count Y∣θ∼binomial⁡(n,θ)Y \mid \theta \sim \operatorname{binomial}(n, \theta).

3.1.1Beta Conjugacy and Kernel Recognition

Definition 3.1 (Conjugate Prior Family). A class 𝒫\mathcal{P} of prior distributions for θ\theta is conjugate for a sampling model p(y∣θ)p(y \mid \theta) ifHoward Raiffa and Robert Schlaifer. Applied Statistical Decision Theory. Harvard Business School, Boston, 1961

p(θ)∈𝒫  ⟹  p(θ∣y)∈𝒫. p(\theta) \in \mathcal{P} \implies p(\theta \mid y) \in \mathcal{P}.

Suppose θ∼beta⁡(a,b)\theta \sim \operatorname{beta}(a, b), with density

p(θ)=Γ(a+b)Γ(a)Γ(b)θa−1(1−θ)b−1 p(\theta) = \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} \theta^{a-1}(1-\theta)^{b-1}

on [0,1][0, 1] (the uniform prior on [0,1][0, 1] is the special case a=b=1a = b = 1). Multiplying prior and binomial likelihood and dropping factors independent of θ\theta gives

p(θ∣y)∝θa−1(1−θ)b−1⋅θy(1−θ)n−y=θ(a+y)−1(1−θ)(b+n−y)−1. p(\theta \mid y) \propto \theta^{a-1}(1 - \theta)^{b-1} \cdot \theta^y (1 - \theta)^{n - y} = \theta^{(a + y) - 1}(1 - \theta)^{(b + n - y) - 1}. (3.2)

Because (3.2) has the exact functional form (kernel) of a beta⁡(a+y, b+n−y)\operatorname{beta}(a + y,\, b + n - y) density and both densities must integrate to 11, they are identically equal—no integration required! This kernel recognition trick is used in every chapter of Hoff.

Proposition 3.2 (Beta–Binomial Update and Prediction). If θ∼beta⁡(a,b)\theta \sim \operatorname{beta}(a, b) and Y1,…,Yn∣θ∼i.i.d.binary⁡(θ)Y_1, \dots, Y_n \mid \theta \stackrel{\text{i.i.d.}}{\sim} \operatorname{binary}(\theta) with y=∑i=1nyiy = \sum_{i=1}^n y_i, set an=a+ya_n = a + y and bn=b+n−yb_n = b + n - y. Then:

  1. Posterior: θ∣y∼beta⁡(an,bn)\theta \mid y \sim \operatorname{beta}(a_n, b_n), with mean

    E[θ∣y]=a+ba+b+n aa+b+na+b+n yn. E[\theta \mid y] = \frac{a + b}{a + b + n}\,\frac{a}{a + b} + \frac{n}{a + b + n}\,\frac{y}{n}. (3.3)
  2. Posterior predictive (single trial): because a future draw Y~\tilde{Y} is conditionally independent of y1,…,yny_1, \dots, y_n given θ\theta (Y~⊥y1:n∣θ\tilde{Y} \perp y_{1:n} \mid \theta),

    Pr⁡(Y~=1∣y1:n)=∫01Pr⁡(Y~=1∣θ,y1:n) p(θ∣y1:n) dθ=∫01θ p(θ∣y1:n) dθ=anan+bn. \Pr(\tilde{Y} = 1 \mid y_{1:n}) = \int_0^1 \Pr(\tilde{Y} = 1 \mid \theta, y_{1:n})\,p(\theta \mid y_{1:n})\,d\theta = \int_0^1 \theta\,p(\theta \mid y_{1:n})\,d\theta = \frac{a_n}{a_n + b_n}. (3.4)
  3. Posterior predictive (mm future trials): the total count S~m=∑j=1mY~j\tilde{S}_m = \sum_{j=1}^m \tilde{Y}_j follows a beta–binomial distribution:

    Pr⁡(S~m=y~∣y1:n)=(my~)B(an+y~, bn+m−y~)B(an,bn),y~∈{0,1,…,m}, \Pr(\tilde{S}_m = \tilde{y} \mid y_{1:n}) = \binom{m}{\tilde{y}} \frac{B(a_n + \tilde{y},\, b_n + m - \tilde{y})}{B(a_n, b_n)}, \qquad \tilde{y} \in \{0, 1, \dots, m\}, (3.5)

    where B(α,β)=Γ(α)Γ(β)/Γ(α+β)B(\alpha, \beta) = \Gamma(\alpha)\Gamma(\beta)/\Gamma(\alpha+\beta).

Notice the intuitive pseudo-count interpretation: aa acts as prior successes, bb as prior failures, and a+ba + b as the prior sample size. Notice also that Y~\tilde{Y} is not marginally independent of y1,…,yny_1, \dots, y_n: the observed data inform θ\theta, which in turn shifts our prediction for Y~\tilde{Y}.

3.2Credible Regions: Coverage, Quantiles, and HPD

After observing Y=yY = y, how do we summarize plausible values of θ\theta with an interval [l(y),u(y)][l(y), u(y)]? Hoff emphasizes the sharp distinction between post-experimental and pre-experimental probability:

Definition 3.3 (Bayesian vs. Frequentist Coverage).

  • An interval [l(y),u(y)][l(y), u(y)] has 100(1−α)%100(1-\alpha)\% Bayesian coverage (a credible interval) if Pr⁡(l(y)<θ<u(y)∣Y=y)=1−α\Pr(l(y) < \theta < u(y) \mid Y = y) = 1 - \alpha.
  • A random interval [l(Y),u(Y)][l(Y), u(Y)] has 100(1−α)%100(1-\alpha)\% frequentist coverage if, before observing YY, Pr⁡(l(Y)<θ<u(Y)∣θ)=1−α\Pr(l(Y) < \theta < u(Y) \mid \theta) = 1 - \alpha for all θ∈Θ\theta \in \Theta.

Under regular continuous models, Welch and PeersB. L. Welch and H. W. Peers. On Formulae for Confidence Points Based on Integrals of Weighted Likelihoods. Journal of the Royal Statistical Society, Series B, 25(2):318–329, 1963 and HartiganJohn A. Hartigan. Note on the Confidence-Prior of Welch and Peers. Journal of the Royal Statistical Society, Series B, 28:55–56, 1966 showed that two-sided 95%95\% Bayesian credible intervals also achieve 95%+O(1/n)95\% + O(1/n) frequentist coverage asymptotically (for discrete binomial data, lattice effects introduce O(n−1/2)O(n^{-1/2}) oscillations unless intervals are randomizedLawrence D. Brown, T. Tony Cai, and Anirban DasGupta. Interval Estimation for a Binomial Proportion. Statistical Science, 16(2):101–133, 2001). Thus Bayesian intervals inherit strong long-run coverage while retaining a direct post-data probability interpretation.

There are two standard ways to construct a 100(1−α)%100(1-\alpha)\% Bayesian region:

  1. Equal-tailed quantile interval: [θα/2,θ1−α/2][\theta_{\alpha/2}, \theta_{1-\alpha/2}], putting α/2\alpha/2 posterior probability in each tail. Easy to compute from quantiles or Monte Carlo draws, and invariant under strictly monotone reparameterizations: if γ=g(θ)\gamma = g(\theta) is strictly increasing, the quantile interval for γ\gamma is simply [g(θα/2),g(θ1−α/2)][g(\theta_{\alpha/2}), g(\theta_{1-\alpha/2})].
  2. Highest Posterior Density (HPD) region: a subset s(y)⊂Θs(y) \subset \Theta with Pr⁡(θ∈s(y)∣y)=1−α\Pr(\theta \in s(y) \mid y) = 1 - \alpha such that every point inside s(y)s(y) has higher posterior density than every point outside: θa∈s(y), θb∉s(y)  ⟹  p(θa∣y)>p(θb∣y)\theta_a \in s(y),\, \theta_b \notin s(y) \implies p(\theta_a \mid y) > p(\theta_b \mid y).

An HPD region is the shortest possible region of a given probability content, and for multimodal posteriors it naturally splits into disjoint intervals. However, unlike quantile intervals, HPD regions are not invariant under nonlinear reparameterizations because the Jacobian ∣dθ/dγ∣\lvert d\theta/d\gamma \rvert reshapes the density height! For θ∣y∼beta⁡(3,9)\theta \mid y \sim \operatorname{beta}(3, 9) (from n=10,y=2n = 10, y = 2 under a uniform prior), the 95% equal-tailed quantile interval is [0.060,0.518][0.060, 0.518] (width 0.4580.458), whereas the 95% HPD interval is [0.041,0.484][0.041, 0.484] (width 0.4430.443, at density threshold h∗=0.585h^* = 0.585; Figure 3.1).Note a typographical slip in the 2009 printing of Hoff (p. 43), which writes [0.04, 0.048] instead of [0.04, 0.48] for the 95% HPD of beta⁡(3,9)\operatorname{beta}(3, 9); see Appendix C.

Three panels: Beta(3, 9) density comparing the 95 percent HPD interval [0.041, 0.484] against the equal-tailed quantile interval [0.060, 0.518]; GSS fertility posterior densities Gamma(219, 112) and Gamma(68, 45); and overlapping Negative Binomial posterior predictive count distributions
Figure 3.1: Left: for the skewed beta⁡(3,9)\operatorname{beta}(3, 9) posterior, the 95% HPD interval (shaded, horizontal cut) is narrower than the equal-tailed quantile interval (dashed). Center and right: GSS fertility rates comparing women without vs. with a bachelor’s degree—posterior densities of the group means θ1,θ2\theta_1, \theta_2 separate cleanly (Pr⁡(θ1>θ2∣y)=0.97\Pr(\theta_1 > \theta_2 \mid y) = 0.97), yet the individual posterior predictive counts Y~1,Y~2\tilde{Y}_1, \tilde{Y}_2 overlap heavily (Pr⁡(Y~1>Y~2∣y)=0.48\Pr(\tilde{Y}_1 > \tilde{Y}_2 \mid y) = 0.48).

3.3The Poisson–Gamma Model

For count data Y1,…,Yn∣θ∼i.i.d.Poisson⁡(θ)Y_1, \dots, Y_n \mid \theta \stackrel{\text{i.i.d.}}{\sim} \operatorname{Poisson}(\theta) with p(y∣θ)=θye−θ/y!p(y \mid \theta) = \theta^y e^{-\theta} / y!, note the mean–variance equality E[Y∣θ]=Var⁡[Y∣θ]=θE[Y \mid \theta] = \operatorname{Var}[Y \mid \theta] = \theta. The likelihood is proportional to θ∑yie−nθ\theta^{\sum y_i} e^{-n\theta}, so ∑i=1nYi\sum_{i=1}^n Y_i is again sufficient, and the conjugate prior is the gamma distribution (shape a>0a > 0, rate b>0b > 0):

p(θ)=baΓ(a) θa−1e−bθ,E[θ]=ab,Var⁡[θ]=ab2. p(\theta) = \frac{b^a}{\Gamma(a)}\,\theta^{a - 1} e^{-b\theta}, \qquad E[\theta] = \frac{a}{b}, \qquad \operatorname{Var}[\theta] = \frac{a}{b^2}. (3.6)

Multiplying prior and likelihood yields the conjugate posterior and the exact negative binomial posterior predictive distribution:

Proposition 3.4 (Poisson–Gamma Update and Predictive Variance). Let θ∼gamma⁡(a,b)\theta \sim \operatorname{gamma}(a, b) and Y1,…,Yn∣θ∼i.i.d.Poisson⁡(θ)Y_1, \dots, Y_n \mid \theta \stackrel{\text{i.i.d.}}{\sim} \operatorname{Poisson}(\theta), with an=a+∑i=1nyia_n = a + \sum_{i=1}^n y_i and bn=b+nb_n = b + n. Then:

  1. Posterior: θ∣y1,…,yn∼gamma⁡(an,bn)\theta \mid y_1, \dots, y_n \sim \operatorname{gamma}(a_n, b_n), with

    E[θ∣y]=bb+nab+nb+ny¯. E[\theta \mid y] = \frac{b}{b+n}\frac{a}{b} + \frac{n}{b+n}\bar{y}.

    Here bb acts as prior sample size and aa as prior total count.

  2. Posterior predictive: integrating out θ\theta gives a negative binomial⁡(an,bn)\operatorname{negative\ binomial}(a_n, b_n) distribution,

    p(y~∣y1,…,yn)=Γ(an+y~)Γ(y~+1) Γ(an)(bnbn+1)an(1bn+1)y~,y~∈{0,1,2,… }, p(\tilde{y} \mid y_1, \dots, y_n) = \frac{\Gamma(a_n + \tilde{y})}{\Gamma(\tilde{y} + 1)\,\Gamma(a_n)} \left(\frac{b_n}{b_n + 1}\right)^{a_n} \left(\frac{1}{b_n + 1}\right)^{\tilde{y}}, \qquad \tilde{y} \in \{0, 1, 2, \dots\}, (3.7)

    with mean and variance

    E[Y~∣y]=anbn=E[θ∣y],Var⁡[Y~∣y]=E[θ∣y] bn+1bn=E[θ∣y]⏟sampling variability+Var⁡[θ∣y]⏟parameter uncertainty. E[\tilde{Y} \mid y] = \frac{a_n}{b_n} = E[\theta \mid y], \qquad \operatorname{Var}[\tilde{Y} \mid y] = E[\theta \mid y]\,\frac{b_n + 1}{b_n} = \underbrace{E[\theta \mid y]}_{\text{sampling variability}} + \underbrace{\operatorname{Var}[\theta \mid y]}_{\text{parameter uncertainty}}. (3.8)

Proof. For the posterior,

p(θ∣y1:n)∝θa−1e−bθ⋅θ∑yie−nθ=θan−1e−bnθ, p(\theta \mid y_{1:n}) \propto \theta^{a-1} e^{-b\theta} \cdot \theta^{\sum y_i} e^{-n\theta} = \theta^{a_n - 1} e^{-b_n \theta},

which is the kernel of gamma⁡(an,bn)\operatorname{gamma}(a_n, b_n). For the predictive distribution, using Y~⊥y1:n∣θ\tilde{Y} \perp y_{1:n} \mid \theta and the gamma integral ∫0∞θα−1e−βθ dθ=Γ(α)/βα\int_0^\infty \theta^{\alpha - 1} e^{-\beta\theta}\,d\theta = \Gamma(\alpha)/\beta^\alpha:

p(y~∣y1:n)=∫0∞θy~e−θy~! bnanΓ(an) θan−1e−bnθ dθ=bnanΓ(y~+1) Γ(an)∫0∞θ(an+y~)−1e−(bn+1)θ dθ=bnanΓ(y~+1) Γ(an) Γ(an+y~)(bn+1)an+y~, \begin{aligned} p(\tilde{y} \mid y_{1:n}) &= \int_0^\infty \frac{\theta^{\tilde{y}} e^{-\theta}}{\tilde{y}!}\,\frac{b_n^{a_n}}{\Gamma(a_n)}\,\theta^{a_n - 1} e^{-b_n \theta}\,d\theta \\ &= \frac{b_n^{a_n}}{\Gamma(\tilde{y} + 1)\,\Gamma(a_n)} \int_0^\infty \theta^{(a_n + \tilde{y}) - 1} e^{-(b_n + 1)\theta}\,d\theta = \frac{b_n^{a_n}}{\Gamma(\tilde{y} + 1)\,\Gamma(a_n)}\,\frac{\Gamma(a_n + \tilde{y})}{(b_n + 1)^{a_n + \tilde{y}}}, \end{aligned}

which rearranges immediately into (3.7). The predictive variance (3.8) follows directly from the law of total variance:

Var⁡[Y~∣y]=E[Var⁡(Y~∣θ)∣y]+Var⁡[E(Y~∣θ)∣y]=E[θ∣y]+Var⁡[θ∣y]. \operatorname{Var}[\tilde{Y} \mid y] = E[\operatorname{Var}(\tilde{Y} \mid \theta) \mid y] + \operatorname{Var}[E(\tilde{Y} \mid \theta) \mid y] = E[\theta \mid y] + \operatorname{Var}[\theta \mid y].

□

Equation (3.8) captures a universal law of Bayesian prediction: predictive variance equals expected sampling variance plus variance from parameter uncertainty. As n→∞n \to \infty, Var⁡[θ∣y]→0\operatorname{Var}[\theta \mid y] \to 0, but irreducible sampling variability E[θ∣y]E[\theta \mid y] remains.

3.3.1Crucial Distinction: Population Means vs. Individuals

In Hoff’s GSS birth-rate analysis (n1=111,∑yi,1=217n_1 = 111, \sum y_{i,1} = 217 for women aged 40 without a bachelor’s degree; n2=44,∑yi,2=66n_2 = 44, \sum y_{i,2} = 66 with a degree; common prior gamma⁡(2,1)\operatorname{gamma}(2, 1)), the posteriors are gamma⁡(219,112)\operatorname{gamma}(219, 112) and gamma⁡(68,45)\operatorname{gamma}(68, 45). Comparing the population means gives Pr⁡(θ1>θ2∣y)=0.97\Pr(\theta_1 > \theta_2 \mid y) = 0.97—strong evidence that the average rates differ. Yet comparing two randomly drawn women yields Pr⁡(Y~1>Y~2∣y)=0.48\Pr(\tilde{Y}_1 > \tilde{Y}_2 \mid y) = 0.48 and Pr⁡(Y~1=Y~2∣y)=0.22\Pr(\tilde{Y}_1 = \tilde{Y}_2 \mid y) = 0.22 (Figure 3.1). Strong evidence of a difference in population means does not imply that the difference is large relative to individual variability.

3.4Exponential Families and Diaconis–Ylvisaker Priors

Both the binomial and Poisson models are instances of a one-parameter exponential family:

p(y∣ϕ)=h(y) c(ϕ) exp⁡(ϕ t(y)), p(y \mid \phi) = h(y)\,c(\phi)\,\exp\bigl(\phi\,t(y)\bigr), (3.9)

where ϕ\phi is the natural parameter and t(y)t(y) is the sufficient statistic. Diaconis and YlvisakerPersi Diaconis and Donald Ylvisaker. Conjugate Priors for Exponential Families. The Annals of Statistics, 7(2):269–281, 1979 proved that the canonical conjugate prior takes the form

p(ϕ∣n0,t0)=κ(n0,t0) c(ϕ)n0 exp⁡(n0t0ϕ), p(\phi \mid n_0, t_0) = \kappa(n_0, t_0)\,c(\phi)^{n_0}\,\exp(n_0 t_0 \phi), (3.10)

which is proper whenever n0>0n_0 > 0 and t0t_0 lies in the interior of the convex hull of the support of t(Y)t(Y). Under nn i.i.d. observations with sample average t¯(y)=1n∑i=1nt(yi)\bar{t}(y) = \frac{1}{n}\sum_{i=1}^n t(y_i), it updates linearly to p(ϕ∣n0+n, n0t0+nt¯(y)n0+n)p\bigl(\phi \mid n_0 + n,\, \frac{n_0 t_0 + n\bar{t}(y)}{n_0 + n}\bigr), and satisfies E[E[t(Y)∣ϕ]]=t0E\bigl[E[t(Y) \mid \phi]\bigr] = t_0: thus t0t_0 is the prior expectation of the mean sufficient statistic and n0n_0 is the equivalent prior sample size.

To translate (3.10) from the natural parameter ϕ\phi back to the standard parameter θ\theta, we apply the change-of-variables Jacobian p(θ)=p(ϕ(θ)) ∣dϕ/dθ∣p(\theta) = p(\phi(\theta))\,\lvert d\phi/d\theta \rvert:

  • Binary: ϕ=log⁡θ1−θ\phi = \log\frac{\theta}{1-\theta}, so c(ϕ)=1−θc(\phi) = 1 - \theta and ∣dϕ/dθ∣=θ−1(1−θ)−1\lvert d\phi/d\theta \rvert = \theta^{-1}(1-\theta)^{-1}, giving

    p(θ)∝(1−θ)n0(θ1−θ)n0t0θ−1(1−θ)−1=θn0t0−1(1−θ)n0(1−t0)−1, p(\theta) \propto (1-\theta)^{n_0} (\frac{\theta}{1-\theta})^{n_0 t_0} \theta^{-1}(1-\theta)^{-1} = \theta^{n_0 t_0 - 1}(1-\theta)^{n_0(1-t_0) - 1},

    i.e. beta⁡(n0t0, n0(1−t0))\operatorname{beta}\bigl(n_0 t_0,\, n_0(1 - t_0)\bigr).

  • Poisson: ϕ=log⁡θ\phi = \log\theta, so c(ϕ)=exp⁡(−eϕ)=e−θc(\phi) = \exp(-e^\phi) = e^{-\theta} and ∣dϕ/dθ∣=θ−1\lvert d\phi/d\theta \rvert = \theta^{-1}, giving p(θ)∝e−n0θ θn0t0 θ−1=θn0t0−1e−n0θp(\theta) \propto e^{-n_0 \theta}\,\theta^{n_0 t_0}\,\theta^{-1} = \theta^{n_0 t_0 - 1} e^{-n_0 \theta}, i.e. gamma⁡(n0t0, n0)\operatorname{gamma}(n_0 t_0,\, n_0).

Table 3.1: One-parameter exponential family structure and Diaconis–Ylvisaker conjugate priors (correcting the sign typo in the 2009 printing of Hoff, p. 52; see Appendix C).
Modelt(y)t(y)Natural ϕ\phic(ϕ)c(\phi)Conjugate prior on θ\thetaWeakly informative (n0=1n_0 = 1)
binary⁡(θ)\operatorname{binary}(\theta)yylog⁡θ1−θ\log\frac{\theta}{1-\theta}(1+eϕ)−1(1 + e^\phi)^{-1}beta⁡(n0t0, n0(1−t0))\operatorname{beta}(n_0 t_0,\, n_0(1-t_0))beta⁡(t0,1−t0)\operatorname{beta}(t_0, 1-t_0); at t0=12t_0=\tfrac12, Jeffreys’ beta⁡(12,12)\operatorname{beta}(\tfrac12,\tfrac12)
Poisson⁡(θ)\operatorname{Poisson}(\theta)yylog⁡θ\log\thetaexp⁡(−eϕ)\exp(-e^\phi)gamma⁡(n0t0, n0)\operatorname{gamma}(n_0 t_0,\, n_0)gamma⁡(t0,1)\operatorname{gamma}(t_0, 1)
import numpy as np
from scipy import stats

# Poisson-Gamma birth rates: exact posterior summaries & Negative Binomial predictive
a, b = 2, 1
n1, sy1 = 111, 217
n2, sy2 = 44, 66

# Note: scipy.stats.gamma uses scale = 1/rate
ci1 = stats.gamma.ppf([0.025, 0.975], a=a + sy1, scale=1 / (b + n1))
ci2 = stats.gamma.ppf([0.025, 0.975], a=a + sy2, scale=1 / (b + n2))
print("No degree 95% CI:", np.round(ci1, 3))
print("Degree    95% CI:", np.round(ci2, 3))

# Posterior predictive PMF: scipy.stats.nbinom(n=a_n, p=b_n/(b_n+1))
y_vals = np.arange(0, 6)
pmf1 = stats.nbinom.pmf(y_vals, a + sy1, (b + n1) / (b + n1 + 1))
print("Pred PMF (no degree, y=0..5):", np.round(pmf1, 3))

3.5Modern Developments: Misspecification and Calibrated Prediction

3.5.1Generalized and Coarsened Posteriors

A generalized posterior replaces the log-likelihood by a chosen loss, and a coarsened posterior tempers the likelihood to allow for a model that is only approximately right.Beyond Hoff (2009). This material is not in Hoff’s book; it follows Bissiri, Holmes, and Walker and Miller and Dunson, and it modernizes the conjugate updates of this chapter for misspecified models.P. G. Bissiri, C. C. Holmes, and S. G. Walker. A General Framework for Updating Belief Distributions. Journal of the Royal Statistical Society Series B: Statistical Methodology, 78(5):1103–1130, 2016. doi: 10.1111/rssb.12158; and Jeffrey W. Miller and David B. Dunson. Robust Bayesian Inference via Coarsening. Journal of the American Statistical Association, 114(527):1113–1125, 2019. doi: 10.1080/01621459.2018.1469995 For a loss ℓ(θ,y)\ell(\theta, y) and learning rate η>0\eta > 0,

pη(θ∣y1:n)∝p(θ) exp⁡{−η∑i=1nℓ(θ,yi)}. p_\eta(\theta \mid y_{1:n}) \propto p(\theta)\,\exp\Bigl\{-\eta \sum_{i=1}^n \ell(\theta, y_i)\Bigr\}. (3.11)

Why it holds: (3.11) is the distribution ν\nu that minimizes η Eν[∑iℓ(θ,yi)]+KL⁡(ν ∥ p)\eta\,E_\nu\bigl[\sum_i \ell(\theta, y_i)\bigr] + \operatorname{KL}(\nu \,\Vert\, p), because that objective equals KL⁡(ν ∥ pη)\operatorname{KL}(\nu \,\Vert\, p_\eta) plus a constant. The choice ℓ=−log⁡p(y∣θ)\ell = -\log p(y \mid \theta), η=1\eta = 1 is Bayes’ rule. Coarsening conditions on the data being close in relative entropy to a sample from the model, with an exponential prior of rate α\alpha on the distance; approximately, this gives the log-likelihood loss with η=ζn=α/(α+n)\eta = \zeta_n = \alpha/(\alpha + n). The Diaconis–Ylvisaker prior (3.10) then updates with ζnn\zeta_n n in place of nn:

n0↦n0+ζnn,beta⁡(a,b)↦beta⁡(a+ζny, b+ζn(n−y)),ζnn=αnα+n→α. n_0 \mapsto n_0 + \zeta_n n, \qquad \operatorname{beta}(a, b) \mapsto \operatorname{beta}\bigl(a + \zeta_n y,\, b + \zeta_n(n - y)\bigr), \qquad \zeta_n n = \frac{\alpha n}{\alpha + n} \to \alpha. (3.12)

The effective sample size saturates at α\alpha, so the posterior width does not vanish. For the GSS data (n=129n = 129, y=118y = 118, uniform prior), α=50\alpha = 50 gives ζnn≈36\zeta_n n \approx 36 and moves the posterior mean and standard deviation from 0.9080.908 and 0.0250.025 to 0.8930.893 and 0.0490.049.

When to use it. Use it when nn is large and small model errors would otherwise yield spurious certainty, or when only a loss is available. If the model is trusted, the ordinary update is sharper; α\alpha or η\eta must be chosen and reported.

3.5.2Conformal Bayes

Conformal Bayes uses a posterior predictive such as (3.7) to rank observations, and draws its coverage from exchangeability rather than from the model.Beyond Hoff (2009). This material is not in Hoff’s book; it follows Fong and Holmes and Hoff’s own later paper. Conformal prediction itself predates 2009, as does the use of Bayesian predictive scores within it; the add-one-in computation and Hoff’s Bayes-optimal formulation come from these later papers.Edwin Fong and Chris C. Holmes. Conformal Bayesian Computation. In Advances in Neural Information Processing Systems, volume 34, pages 18268–18279, 2021; and Peter Hoff. Bayes-optimal prediction with frequentist coverage control. Bernoulli, 29(2):901–928, 2023. doi: 10.3150/22-BEJ1484 For a candidate value yy of Yn+1Y_{n+1}, put yn+1=yy_{n+1} = y, let σi=p(yi∣y1:n+1)\sigma_i = p(y_i \mid y_{1:n+1}) be the predictive density of observation ii given the augmented sample, and define

π(y)=1n+1∑i=1n+1𝟏(σi≤σn+1),Cα(y1:n)={y:π(y)>α}. \pi(y) = \frac{1}{n+1}\sum_{i=1}^{n+1} \mathbf{1}(\sigma_i \le \sigma_{n+1}), \qquad C_\alpha(y_{1:n}) = \{y : \pi(y) > \alpha\}. (3.13)

Why it holds: the augmented posterior is symmetric in the n+1n + 1 observations, so if Y1,…,Yn+1Y_1, \dots, Y_{n+1} are exchangeable (Definition 2.4) then so are the scores. Hence Pr⁡(π(Yn+1)≤α)≤α\Pr(\pi(Y_{n+1}) \le \alpha) \le \alpha, and Pr⁡(Yn+1∈Cα)≥1−α\Pr(Y_{n+1} \in C_\alpha) \ge 1 - \alpha for every nn, even if the sampling model is wrong. No refitting is required: draws θ(s)∼p(θ∣y1:n)\theta^{(s)} \sim p(\theta \mid y_{1:n}) with weights proportional to p(y∣θ(s))p(y \mid \theta^{(s)}) (“add-one-in” importance sampling) target the augmented posterior. In the Poisson–gamma model even this is unnecessary, since σi\sigma_i is the negative binomial⁡(an+y, bn+1)\operatorname{negative\ binomial}(a_n + y,\, b_n + 1) probability of yiy_i.

Hoff’s version starts from the opposite end: among prediction regions with guaranteed frequentist coverage, it seeks the one with the smallest expected volume under the Bayesian model. The prior then buys precision, not validity.

When to use it. Use it when prediction intervals must be calibrated in repeated use and the sampling model is doubtful. The guarantee is marginal over the sample and the new observation, not conditional on the realized y1:ny_{1:n}. Since data that are i.i.d. given θ\theta are exchangeable, it holds at every fixed θ\theta: it is a predictive analogue, with ≥\ge, of the frequentist coverage in Definition 3.3. With a credible model, the predictive (3.7) alone is simpler and gives full probabilities.

3.5.3Computational & Symbolic Check

The Python block reproduces the coarsened GSS posterior of (3.12) and evaluates the conformal set (3.13) for the illustrative counts y=(0,1,2,2,6)y = (0, 1, 2, 2, 6) under a gamma⁡(2,2)\operatorname{gamma}(2, 2) prior, so that an=13a_n = 13 and bn=7b_n = 7.Beyond Hoff (2009). This computational check and its Wolfram symbolic counterpart below verify the modern methods in this section and are not in Hoff’s book.

import numpy as np
from scipy import stats

n, y, alpha = 129, 118, 50                       # coarsened GSS posterior, uniform prior
for zeta in (1.0, alpha / (alpha + n)):
    post = stats.beta(1 + zeta * y, 1 + zeta * (n - y))
    print(f"ESS={zeta*n:.2f}: mean={post.mean():.4f}, sd={post.std():.4f}")
for m in (10**3, 10**5, 10**7):
    print(f"n={m}: ESS={alpha*m/(alpha+m):.3f} -> {alpha}")

data, a, b = np.array([0, 1, 2, 2, 6]), 2, 2     # conformal Bayes, Poisson-gamma
an, bn = a + data.sum(), b + len(data)
def conf_p(yc):
    aug = np.append(data, yc)
    sig = stats.nbinom.pmf(aug, an + yc, (bn + 1) / (bn + 2))
    return np.mean(sig <= sig[-1])
p = [conf_p(k) for k in range(9)]
print(np.round(p, 3), "80% set:", [k for k in range(9) if p[k] > 0.2])
Write the effective sample size ζnn\zeta_n n of the coarsened posterior, with ζn=α/(α+n)\zeta_n = \alpha/(\alpha + n).
// Chapter 3 (modern): coarsened beta posterior & conformal negative-binomial score
const ess = await show`al*n/(al + n)`
ζnn=α nα+n \zeta_n n = \frac{\alpha\, n}{\alpha + n} Take n→∞n \to \infty in the effective sample size ζnn\zeta_n n: it saturates at α\alpha.
await show`Limit[${ess}, n -> Infinity, Assumptions -> al > 0]`
lim⁡n→∞ζnn=α \lim_{n \to \infty} \zeta_n n = \alpha Posterior effective size, mean, and SD for the ordinary (ζ=1\zeta = 1) and coarsened (α=50\alpha = 50) GSS updates.
await show`N[Table[With[{a = 1 + z*118, b = 1 + z*11},
  {129*z, a/(a + b), Sqrt[a*b/((a + b)^2*(a + b + 1))]}], {z, {1, 50/179}}]]`
(ζnn,  𝔼[θ∣y],  SD⁡(θ∣y))ζ=1,  50/179=(129.0.9083970.025107636.03350.892920.0494927) \bigl(\zeta_n n,\; \mathbb{E}[\theta \mid y],\; \operatorname{SD}(\theta \mid y)\bigr)_{\zeta = 1,\; 50/179} = \left( \begin{array}{ccc} 129. & 0.908397 & 0.0251076 \\ 36.0335 & 0.89292 & 0.0494927 \\ \end{array} \right) Write the closed-form conformal score σi\sigma_i, a negative-binomial probability with shape an+ya_n + y and rate bn+1b_n + 1.
const sig = await show`(bn + 1)^(an + y)*(bn + 2)^(-an - y - yi)*Gamma[an + y + yi] / (yi! * Gamma[an + y])`
σi=(1+bn)an+y(2+bn)−an−y−yiΓ(an+y+yi)yi!Γ(an+y) \sigma_i = \frac{(1+b_n)^{a_n +y} (2+b_n)^{-a_n -y-y_i} \Gamma (a_n +y+y_i)}{y_i ! \Gamma (a_n +y)} Verify it by integrating the Poisson density of yiy_i over the augmented gamma⁡(an+y,bn+1)\operatorname{gamma}(a_n + y, b_n + 1) posterior.
await show`Assuming[an > 0 && bn > 0 && y >= 0 && yi >= 0 && Element[{y, yi}, Integers], FullSimplify[
  Integrate[th^yi*Exp[-th]/yi! * (bn + 1)^(an + y)/Gamma[an + y]*th^(an + y - 1)*Exp[-(bn + 1)*th],
    {th, 0, Infinity}] / (${sig})]]`
1σi∫0∞Poisson⁡(yi∣θ) Gamma⁡(θ∣an+y,bn+1) dθ=1 \frac{1}{\sigma_i}\int_0^\infty \operatorname{Poisson}(y_i \mid \theta)\,\operatorname{Gamma}(\theta \mid a_n + y, b_n + 1)\,d\theta = 1 Compute exact conformal π(y)\pi(y) for y=0,…,8y = 0, \dots, 8: at level α=0.2\alpha = 0.2 the set is {0,…,6}\{0, \dots, 6\}.
await show`Table[With[{s = Table[(${sig}) /. {an -> 13, bn -> 7, y -> yc, yi -> v}, {v, {0, 1, 2, 2, 6, yc}}]},
  Count[s, v_ /; v <= Last[s]]/6], {yc, 0, 8}]`
(π(y))y=08={12,1,56,12,13,13,13,16,16} \bigl(\pi(y)\bigr)_{y=0}^{8} = \left\{\frac{1}{2},1,\frac{5}{6},\frac{1}{2},\frac{1}{3},\frac{1}{3},\frac{1}{3},\frac{1}{6},\frac{1}{6}\right\}

3.6Symbolic Check in Wolfram Language

Integrates θ\theta out of the Poisson–Gamma posterior symbolically in wolfram-ws-bridge JavaScript mode to recover the Negative Binomial predictive PMF, mean, and variance, derives the general symbolic Beta interval mass ∫lup(t∣a,b) dt\int_l^u p(t \mid a, b)\,dt, and then instantiates both on the GSS fertility counts and the beta⁡(3,9)\operatorname{beta}(3, 9) 95% HPD interval.

Integrate θ\theta out of the Poisson–Gamma product to derive the Negative Binomial predictive PMF.
// Chapter 3: Symbolic Poisson-Gamma predictive & general Beta(a,b) HPD integral
const { Times, Divide, Power, Exp, Minus, Subtract, Gamma, Factorial, th, yt, an, bn } = W
const pois = Divide(Times(Power(th, yt), Exp(Minus(th))), Factorial(yt))
const gam = Times(Divide(Power(bn, an), Gamma(an)), Power(th, Subtract(an, 1)), Exp(Times(-1, bn, th)))
const pred = await show`Assuming[an > 0 && bn > 0 && yt >= 0 && Element[yt, Integers],
  FullSimplify[Integrate[${pois} * ${gam}, {th, 0, Infinity}]]]`
p(y~∣y)=∫0∞Poisson⁡(y~∣θ) Gamma⁡(θ∣an,bn) dθ=bnan(1+bn)−an−y~Γ(an+y~)y~!Γ(an) \begin{aligned} &p(\tilde{y} \mid y) = \int_0^\infty \operatorname{Poisson}(\tilde{y} \mid \theta)\,\operatorname{Gamma}(\theta \mid a_n, b_n)\,d\theta \\ &= \frac{b_n^{a_n} (1+b_n)^{-a_n -\tilde{y}} \Gamma (a_n +\tilde{y})}{\tilde{y} ! \Gamma (a_n)} \end{aligned} Sum y~ p(y~∣y)\tilde{y}\,p(\tilde{y} \mid y) over all non-negative integers to obtain the predictive mean an/bna_n/b_n.
const predMean = await show`Assuming[an > 0 && bn > 0, FullSimplify[Sum[yt * ${pred}, {yt, 0, Infinity}]]]`
𝔼[y~∣y]=anbn \mathbb{E}[\tilde{y} \mid y] = \frac{a_n}{b_n} Compute the symbolic predictive variance, showing overdispersion factor (1+bn)/bn(1 + b_n)/b_n relative to Poisson.
await show`Assuming[an > 0 && bn > 0,
  FullSimplify[Sum[yt^2 * ${pred}, {yt, 0, Infinity}] - (${predMean})^2]]`
Var⁡(y~∣y)=an(1+bn)bn2 \operatorname{Var}(\tilde{y} \mid y) = \frac{a_n (1+b_n)}{b_n^2} Integrate the beta⁡(a,b)\operatorname{beta}(a, b) density over (l,u)(l, u) to form the general HPD probability constraint.
// Symbolic interval probability Int_l^u Beta(a, b) for general HPD system
const betaMass = await show`Assuming[a > 0 && b > 0 && 0 < l < u < 1,
  FullSimplify[Integrate[t^(a - 1)*(1 - t)^(b - 1) / Beta[a, b], {t, l, u}]]]`
∫luBeta⁡(t∣a,b) dt=−Bl(a,b)+Bu(a,b)B(a,b) \int_l^u \operatorname{Beta}(t \mid a, b)\,dt = \frac{-B_l(a,b)+B_u(a,b)}{B(a,b)} Instantiate the GSS no-degree posterior predictive PMF for y~=0,…,5\tilde{y} = 0, \dots, 5.
// Instantiate GSS no-degree group (an = 219, bn = 112) and Beta(3, 9) 95% HPD
await show`N[Table[${pred} /. {an -> 219, bn -> 112}, {yt, 0, 5}]]`
(p(y~∣y))y~=05 at (an,bn)=(219,112)={0.142747,0.276652,0.269307,0.175566,0.0862293,0.0340339} \begin{aligned} &\bigl(p(\tilde{y} \mid y)\bigr)_{\tilde{y}=0}^5 \text{ at } (a_n, b_n) = (219, 112) \\ &= \{0.142747,0.276652,0.269307,0.175566,0.0862293,0.0340339\} \end{aligned} Solve the equal-density and 95%95\% mass equations simultaneously for the exact beta⁡(3,9)\operatorname{beta}(3, 9) HPD interval.
await show`{l, u, u - l} /. FindRoot[{
  l^(a - 1)*(1 - l)^(b - 1) == u^(a - 1)*(1 - u)^(b - 1),
  (${betaMass}) == 95/100} /. {a -> 3, b -> 9}, {{l, 0.04}, {u, 0.48}}]`
(l,  u,  u−l)Beta⁡(3,9) 95% HPD={0.0405552,0.483724,0.443168} \begin{aligned} &\bigl(l,\; u,\; u - l\bigr)_{\operatorname{Beta}(3, 9)\text{ 95\% HPD}} \\ &= \{0.0405552,0.483724,0.443168\} \end{aligned}

3.7Exercises

Exercise 3.5. Let θ∣y∼beta⁡(3,9)\theta \mid y \sim \operatorname{beta}(3, 9) and define the log-odds γ=log⁡θ1−θ\gamma = \log\frac{\theta}{1-\theta}. Compute both the equal-tailed 95% credible interval and the 95% HPD interval for γ\gamma, and compare them against the log-odds transform of the θ\theta-intervals [0.060,0.518][0.060, 0.518] and [0.041,0.484][0.041, 0.484]. Verify that the quantile interval transforms identically while the HPD interval does not.

Symbolic Solution & InstantiationDerive the exact log-odds density pγ(g)p_\gamma(g) of γ=logit⁡(θ)\gamma = \operatorname{logit}(\theta) via the logistic Jacobian.
// Ex 3.1: Log-odds HPD non-invariance vs. quantile monotone invariance for Beta(3, 9)
const pg = await show`FullSimplify[(E^(a*g)*(1 + E^g)^(-a - b)) / Beta[a, b]]`
pγ(g)=pθ ⁣(eg1+eg)∣ddgeg1+eg∣=eag(1+eg)−a−bB(a,b) \begin{aligned} &p_\gamma(g) = p_\theta\!\left(\frac{e^g}{1+e^g}\right)\left|\frac{d}{dg}\frac{e^g}{1+e^g}\right| \\ &= \frac{e^{a g} \left(1+e^g\right)^{-a-b}}{B(a,b)} \end{aligned} Solve directly for the 2.5%2.5\% and 97.5%97.5\% quantiles of γ\gamma under beta⁡(3,9)\operatorname{beta}(3, 9).
await show`{g /. FindRoot[Integrate[${pg} /. {a -> 3, b -> 9}, {g, -Infinity, g}] == 25/1000, {g, -2.7}],
  g /. FindRoot[Integrate[${pg} /. {a -> 3, b -> 9}, {g, -Infinity, g}] == 975/1000, {g, 0.1}]}`
(q0.025γ,  q0.975γ)Beta⁡(3,9)={−2.74768,0.0710533} \begin{aligned} &\bigl(q_{0.025}^\gamma,\; q_{0.975}^\gamma\bigr)_{\operatorname{Beta}(3,9)} \\ &= \{-2.74768,0.0710533\} \end{aligned} Solve for the true 95%95\% HPD interval directly on the log-odds scale γ\gamma.
await show`{gl, gu} /. FindRoot[{
  (${pg} /. {a -> 3, b -> 9, g -> gl}) == (${pg} /. {a -> 3, b -> 9, g -> gu}),
  Integrate[${pg} /. {a -> 3, b -> 9}, {g, gl, gu}] == 95/100}, {{gl, -2.9}, {gu, 0.0}}]`
(gLHPD,  gUHPD)Beta⁡(3,9)={−2.65578,0.144331} \begin{aligned} &\bigl(g_L^{\text{HPD}},\; g_U^{\text{HPD}}\bigr)_{\operatorname{Beta}(3,9)} \\ &= \{-2.65578,0.144331\} \end{aligned} Transform the θ\theta-scale HPD endpoints via logit⁡\operatorname{logit} to show they disagree with the true γ\gamma-HPD.
await show`N[{Log[0.0406/(1 - 0.0406)], Log[0.4837/(1 - 0.4837)]}]`
(logit⁡(0.0406),  logit⁡(0.4837))={−3.16254,−0.0652231} \bigl(\operatorname{logit}(0.0406),\; \operatorname{logit}(0.4837)\bigr) = \{-3.16254,-0.0652231\}

Exercise 3.6. Using the law of total variance, derive the exact mean and variance of the beta–binomial posterior predictive count S~m\tilde{S}_m in (3.5), and show that its variance exceeds the binomial variance mθ¯(1−θ¯)m \bar{\theta}(1 - \bar{\theta}) by a factor (an+bn+m)/(an+bn+1)(a_n + b_n + m)/(a_n + b_n + 1).

Symbolic Solution & InstantiationWrite the posterior mean θ¯\bar{\theta} of θ∼beta⁡(an,bn)\theta \sim \operatorname{beta}(a_n, b_n).
// Ex 3.2: Beta-Binomial posterior predictive mean, variance & overdispersion factor
const meanT = await show`an / (an + bn)`
𝔼[θ∣y]=anan+bn \mathbb{E}[\theta \mid y] = \frac{a_n}{a_n +b_n} Write the posterior variance of θ∼beta⁡(an,bn)\theta \sim \operatorname{beta}(a_n, b_n).
const varT = await show`(an*bn) / ((an + bn)^2*(an + bn + 1))`
Var⁡(θ∣y)=anbn(an+bn)2(1+an+bn) \operatorname{Var}(\theta \mid y) = \frac{a_n b_n}{(a_n +b_n)^2 (1+a_n +b_n)} Compute the Beta–Binomial posterior predictive mean E[S~m∣y]E[\tilde{S}_m \mid y] symbolically.
const meanS = await show`Factor[m * ${meanT}]`
𝔼[S~m∣y]=anman+bn \mathbb{E}[\tilde{S}_m \mid y] = \frac{a_n m}{a_n +b_n} Combine within- and between-θ\theta variance terms to derive the exact Beta–Binomial predictive variance.
const varS = await show`Factor[m*((${meanT})*(1 - ${meanT}) - ${varT}) + m^2*(${varT})]`
Var⁡(S~m∣y)=anbnm(an+bn+m)(an+bn)2(1+an+bn) \operatorname{Var}(\tilde{S}_m \mid y) = \frac{a_n b_n m (a_n +b_n +m)}{(a_n +b_n)^2 (1+a_n +b_n)} Divide by the plug-in Binomial variance to isolate the exact overdispersion multiplier.
const ratio = await show`Factor[${varS} / (m*(${meanT})*(1 - ${meanT}))]`
Var⁡(S~m∣y)m θ¯(1−θ¯)=an+bn+m1+an+bn \begin{aligned} &\frac{\operatorname{Var}(\tilde{S}_m \mid y)}{m\,\bar{\theta}(1 - \bar{\theta})} \\ &= \frac{a_n +b_n +m}{1+a_n +b_n} \end{aligned} Instantiate the predictive mean and overdispersion factor at beta⁡(2,40)\operatorname{beta}(2, 40) with m=20m = 20 future trials.
await show`N[{${meanS}, ${ratio}} /. {an -> 2, bn -> 40, m -> 20}]`
(𝔼[S~20∣y],  overdispersion ratio)Beta⁡(2,40)={0.952381,1.44186} \begin{aligned} &\bigl(\mathbb{E}[\tilde{S}_{20}\mid y],\; \text{overdispersion ratio}\bigr)_{\operatorname{Beta}(2,40)} \\ &= \{0.952381,1.44186\} \end{aligned}

Exercise 3.7. Cast the exponential sampling model p(y∣θ)=θe−θyp(y \mid \theta) = \theta e^{-\theta y} (y>0,θ>0y > 0, \theta > 0) into the exponential-family form (3.9), write down its Diaconis–Ylvisaker conjugate prior (3.10), and confirm that the conjugate family is gamma⁡(a,b)\operatorname{gamma}(a, b).

Symbolic Solution & InstantiationWrite the Diaconis–Ylvisaker conjugate prior kernel in the natural parameter ϕ=−θ\phi = -\theta of the exponential model.
// Ex 3.3: Exponential model (h=1, c=-phi, t=y) -> Diaconis-Ylvisaker prior -> Gamma(n0 + 1, n0*t0)
const dyPhi = await show`(-phi)^n0 * Exp[n0 * t0 * phi]`
p(ϕ∣n0,t0)∝exp⁡ ⁣(n0t0ϕ−n0(−log⁡(−ϕ)))=en0ϕt0(−ϕ)n0 \begin{aligned} &p(\phi \mid n_0, t_0) \propto \exp\!\bigl(n_0 t_0 \phi - n_0(-\log(-\phi))\bigr) \\ &= e^{n_0 \phi t_0} (-\phi)^{n_0} \end{aligned} Transform back to the rate scale θ=−ϕ\theta = -\phi with unit Jacobian to recognize the gamma⁡(n0+1,n0t0)\operatorname{gamma}(n_0 + 1, n_0 t_0) kernel.
await show`FullSimplify[(${dyPhi} /. phi -> -th) * Abs[D[-th, th]], th > 0]`
p(θ∣n0,t0)∝p(ϕ∣n0,t0)∣ϕ=−θ ∣dϕdθ∣=e−n0t0θθn0 \begin{aligned} &p(\theta \mid n_0, t_0) \propto p(\phi \mid n_0, t_0)\big|_{\phi = -\theta}\,\left|\frac{d\phi}{d\theta}\right| \\ &= e^{-n_0 t_0 \theta} \theta^{n_0} \end{aligned} Instantiate the induced Gamma shape, rate, and prior mean at (n0,t0)=(2,3)(n_0, t_0) = (2, 3).
await show`{n0 + 1, n0*t0, (n0 + 1)/(n0*t0)} /. {n0 -> 2, t0 -> 3}`
(shape,  rate,  𝔼[θ])n0=2,  t0=3={3,6,12} \begin{aligned} &\bigl(\text{shape},\; \text{rate},\; \mathbb{E}[\theta]\bigr)_{n_0=2,\; t_0=3} \\ &= \left\{3,6,\frac{1}{2}\right\} \end{aligned}