Perform a mixed predictive replication for hierarchical models when prior is improper?

In the example of rat tumor in BDA chapter 5.1, the model is

y_j \sim binomial(n_j,\theta_j) \\ \theta_j \sim beta(\alpha,\beta) \\ \pi(\alpha,\beta) \propto (\alpha+\beta)^{-2/5} \\

The prior is improper, how to perform a mixed predictive replication for hierarchical models?

I think I have done the work.
The Stan codes is as follows,

generated quantities {
  array[N] real theta_rep;
  array[N] int<lower=0> y_rep;
  for (i in  1:N) {
  theta_rep[i] = beta_rng(alpha, beta);
  y_rep[i] = binomial_rng(n[i],theta_rep[i]);
  }
}
1 Like

That section goes on to suggest an alternative parameterization in terms of \alpha / \beta and \alpha + \beta where the latter gets a distribution p(\alpha + \beta) \propto (\alpha + \beta)^{\frac{-5}{2}} (you had the ratio flipped here), which is equivalent to \alpha + \beta \sim \text{Pareto}(\epsilon, 1.5) for some \epsilon > 0 and \alpha + \beta > \epsilon. Then you can take \alpha / \beta to have a uniform prior and you have a proper prior.

In Stan:

data {
  int<lower=0> n_rats;
  int<lower=0> n_groups;
  array[n_groups] int<lower=0, upper=n_rats> survive;
}
parameters {
  vector<lower=0, upper=1>[n_grops] theta;
  real<lower=0, upper=1> phi;  // phi = a / b in beta(a, b) param
  real<lower=2> kappa;  // kappa = a + b
}
model {
  phi ~ uniform(0, 1); // redundant
  kappa ~ pareto(2, 1.5);  // BDA3 prior (section 5.3); 2 is lower bound on kappa
  theta ~ beta_proportion(phi, kappa);  // equiv: theta ~ beta(phi * kappa, (1 - phi) * kappa)
  survive ~ binomial(n_rats, theta);
}

Pareto: Positive Lower-Bounded Distributions

Beta reparameterization: Reparameterization and Change of Variables

Built-in reparameterized beta proportion: Continuous Distributions on [0, 1]

1 Like

if I am sure the rate of tumor is more than 0.3, is it better to specify a informative prior? such as

phi ~ uniform(0.3, 1);

To make use of the information from the actual data as possible. Can i find an optimal value of hyperparameters by minimizing the distance between the simulation data from prior predictive checks and the actual data, such as MSE?
`