Appendix A — Distributions and Conjugate Updates

This appendix collects the conjugate updates used in this book and its companion. Each entry gives the prior, the likelihood, the posterior, the predictive distribution and the effective sample size of the prior, which is the number of observations the prior is worth. Here \(\mathrm{B}(\cdot,\cdot)\) is the beta function.

A.1 Beta binomial

  • Prior: \(p \sim \mathrm{Beta}(a, b)\), with mean \(a/(a+b)\). Here \(a\) and \(b\) are hyperparameters, not an action.
  • Likelihood: \(x\) successes in \(n\) Bernoulli trials, \(\propto p^x (1-p)^{n-x}\).
  • Posterior: \(\mathrm{Beta}(a + x, b + n - x)\).
  • Predictive for \(y\) successes in \(m\) further trials:

\[ \Pr(y) = \binom{m}{y}\frac{\mathrm{B}(a + x + y,\; b + n - x + m - y)}{\mathrm{B}(a + x,\; b + n - x)}. \]

  • Effective sample size: \(a + b\).

Used for response rates, toxicity monitoring, dose escalation and the power prior, where a historical sample discounted by \(a_0\) adds \(a_0 y_0\) and \(a_0(n_0 - y_0)\) to the two parameters. The companion volume, Bayesian Clinical Trials, treats these uses.

A.2 Normal with known variance

  • Prior: \(\theta \sim N(m_0, s_0^2)\).
  • Likelihood: an estimate \(\hat\theta \sim N(\theta, s^2)\), for example a log hazard ratio with \(s^2 = 4/D\) or a mean difference with \(s^2 = 2\sigma^2/n\).
  • Posterior: \(N(m_1, s_1^2)\) with \(s_1^{-2} = s_0^{-2} + s^{-2}\) and \(m_1 = s_1^2(m_0/s_0^2 + \hat\theta/s^2)\).
  • Predictive for a new estimate with variance \(s_{\text{new}}^2\): \(N(m_1, s_1^2 + s_{\text{new}}^2)\).
  • Effective sample size: \(\sigma^2/s_0^2\) observations for a single mean, \(2\sigma^2/s_0^2\) patients per arm for a mean difference with \(s^2 = 2\sigma^2/n\), or \(4/s_0^2\) events for a log hazard ratio.

This is the workhorse of the trial reanalyses of the companion volume, of assurance and of value of information (Chapter 11). A small check of the update with a prior centred on no effect and worth 25 events, and an observed hazard ratio of 0.8 from 100 events:

Show the R code
m0 <- 0; s0 <- sqrt(4 / 25)
th <- log(0.8); s <- sqrt(4 / 100)
s1 <- 1 / sqrt(1 / s0^2 + 1 / s^2)
m1 <- s1^2 * (m0 / s0^2 + th / s^2)
c(post_mean = m1, post_sd = s1, hr = exp(m1))
 post_mean    post_sd         hr 
-0.1785148  0.1788854  0.8365116 

The posterior precision is the sum of the two precisions, so the posterior is worth 125 events, and the posterior mean lies four fifths of the way from the prior mean to the estimate. The posterior hazard ratio is 0.84.

A.3 Normal with unknown variance

  • Prior: \(\theta \mid \sigma^2 \sim N(m_0, \sigma^2/k_0)\) and \(\sigma^2 \sim \mathrm{InvGamma}(\nu_0/2, \nu_0 \sigma_0^2/2)\).
  • Likelihood: \(n\) observations with mean \(\bar y\) and sum of squared deviations \(S = \sum_i (y_i - \bar y)^2\).
  • Posterior: \(k_n = k_0 + n\), \(m_n = (k_0 m_0 + n \bar y)/k_n\), \(\nu_n = \nu_0 + n\), and

\[ \nu_n \sigma_n^2 = \nu_0 \sigma_0^2 + S + \frac{k_0 n}{k_n}(\bar y - m_0)^2 . \]

  • Marginal posterior of \(\theta\): Student \(t\) with \(\nu_n\) degrees of freedom, location \(m_n\) and scale \(\sigma_n/\sqrt{k_n}\).
  • Effective sample size: \(k_0\) for the mean and \(\nu_0\) for the variance.

A.4 Gamma Poisson and exponential survival

  • Prior: \(\lambda \sim \mathrm{Gamma}(a, b)\) with shape \(a\) and rate \(b\), so the mean is \(a/b\).
  • Likelihood: \(d\) events in exposure \(T\), \(\propto \lambda^d e^{-\lambda T}\), for Poisson counts or exponential survival with noninformative censoring.
  • Posterior: \(\mathrm{Gamma}(a + d, b + T)\).
  • Predictive for counts in further exposure \(T_{\text{new}}\): negative binomial with size \(a + d\) and success probability \((b + T)/(b + T + T_{\text{new}})\) (the convention of R’s dnbinom, counting failures), so the mean is \((a + d)T_{\text{new}}/(b + T)\).
  • Effective sample size: \(a\) events in \(b\) units of exposure.

In the piecewise exponential model each interval has its own gamma update. In the gamma Poisson shrinker of the companion volume the prior is a two component gamma mixture, and the posterior is a mixture of the two updated components with weights proportional to the prior weights times the negative binomial marginal likelihoods.

A.5 Dirichlet multinomial

  • Prior: \((\pi_1, \dots, \pi_K) \sim \mathrm{Dirichlet}(\alpha_1, \dots, \alpha_K)\).
  • Likelihood: counts \((n_1, \dots, n_K)\).
  • Posterior: \(\mathrm{Dirichlet}(\alpha_1 + n_1, \dots, \alpha_K + n_K)\).
  • Effective sample size: \(\sum_k \alpha_k\).

Used for categorical outcomes such as the joint efficacy and toxicity outcomes of the companion volume, where \(K = 4\).

A.6 Normal hierarchical model

  • Model: \(\hat\theta_j \sim N(\theta_j, s_j^2)\) and \(\theta_j \sim N(\mu, \tau^2)\) for \(j = 1, \dots, J\).
  • Conditional posterior: \(\theta_j \mid \mu, \tau, \hat\theta_j \sim N\bigl(B_j \mu + (1 - B_j)\hat\theta_j,\; (1 - B_j)s_j^2\bigr)\) with shrinkage factor \(B_j = s_j^2/(s_j^2 + \tau^2)\).
  • Marginal posterior of \(\tau\) with a flat prior on \(\mu\): proportional to \(p(\tau)\,V_\mu^{1/2}\prod_j (s_j^2 + \tau^2)^{-1/2}\exp\{-(\hat\theta_j - \hat\mu)^2/(2(s_j^2 + \tau^2))\}\), where \(\hat\mu\) is the precision weighted mean of the \(\hat\theta_j\) given \(\tau\) and \(V_\mu\) is its variance.

Used for subgroups, basket trials and meta analysis. The choice of prior on \(\tau\) matters when \(J\) is small; a half normal or half Cauchy with a scale chosen on clinical grounds is a sound default.

A.7 The information time approximation

For a log hazard ratio with one to one allocation, \(\operatorname{Var}(\hat\theta) \approx 4/D\) with \(D\) events; for unequal allocation with fractions \(r\) and \(1 - r\), \(\operatorname{Var}(\hat\theta) \approx 1/(r(1-r)D)\). The information fraction at an interim analysis is the ratio of events observed to events planned, and a Brownian motion in information time describes the path of the score statistic, which is what the group sequential and anytime valid calculations of the companion volume use.