Sensitivity to the prior and change of variables

STA360 at Duke University

Sensitivity to the prior

Practice exercise

A cancer laboratory is estimating the rate of tumorigenesis in two strains of mice, \(A\) and \(B\). They have tumor count data for 10 mice in strain \(A\) and 13 mice in strain \(B\),

yA = c(12, 9, 12, 14, 13, 13, 15, 8, 15, 6)
yB = c(11, 11, 10, 9, 9, 8, 7, 10, 6, 8, 8, 9, 7)

Assume

\[ \begin{aligned} Y_A &\sim \text{Poisson}(\theta_A)\\ Y_B &\sim \text{Poisson}(\theta_B). \end{aligned} \]

Let

\[ \begin{aligned} \theta_A &\sim \text{gamma}(120, 10)\\ \theta_B &\sim \text{gamma}(12, 1). \end{aligned} \]

  • Compute \(p(\theta_B < \theta_A ~|~ \vec{y}_A, \vec{y}_B)\) via Monte Carlo sampling.

Let

\[ \begin{aligned} \theta_A &\sim \text{gamma}(120, 10)\\ \theta_B &\sim \text{gamma}(12\cdot n_0, n_0). \end{aligned} \]

  • For a range of values of \(n_0\), obtain \(p(\theta_B < \theta_A ~|~ \vec{y}_A, \vec{y}_B)\).

  • Describe how sensitive conclusions about the event \(\{ \theta_B < \theta_A\}\) are to the prior distribution on \(\theta_B\).

Change of variables

Practice exercise

  • Let \(X \sim \text{Unif}(5, 10)\)
  • Let \(Y = X^2\)

Notice that even though \(X^2\) is not a monotonic function everywhere, it is a monotonic function over the support of X.

Exercise: use the change of variables formula to derive \(p(y)\). Confirm with Monte Carlo simulation.

Show solution
library(tidyverse)

x = runif(100000, 5, 10)
y = x^2

df = data.frame(y)

f = function(y) {
  return(.1/sqrt(y))
}

df %>%
  ggplot(aes(x = y)) + 
  stat_function(fun = f) +
  geom_histogram(aes(x = y, y = ..density..),
                 fill = 'steelblue', alpha = 0.5)