9

I am fitting several multi-level hierarchical regression models using rstan. Each of these models has a unit information prior over the top-level distribution. The unit priors' parameters were originally store in an R list. My questions are:

  1. Do I pass the unit information prior parameters for a particular model from the list where the rest of the data is stored?
  2. Where do I declare these prior parameters? In the parameters block?

Thanks.

Brash Equilibrium
  • 3,565
  • 1
  • 25
  • 43

1 Answers1

11

I would distinguish between the prior distribution and the parameters for the prior distribution. When I started with Stan, I would set the parameters to the prior distributions just as some values. So in the model step, I would have something like

model {    
     mu ~ normal(0, 1)
     y ~ normal(mu, s)
}

for a normal prior on the mean coefficient for the distribution of y.

However, as I've been using Stan more, I have tended to include them in the data step (i.e., the list you refer to where the rest of the data is stored). In this format, I would supplement the data step with

data {
    real mu_prior_1
    real<lower=0> mu_prior_2
}

and adjust the model step to something like

model {    
     mu ~ normal(mu_prior_1, mu_prior_2)
     y ~ normal(mu, s)
}

The main reason I've been doing this is because it makes it easier for me to change the priors without changing the rest of the Stan code.

John
  • 2,117
  • 16
  • 24