# Non-centered parameterization with gamma priors for variance

I have a question about non-centered parameterization just to make sure I’m not doing anything wrong. Suppose I have:

``````parameter {
real beta_raw;
real mu;
real<lower = 0> sigma;

}
transformed parameters {
real beta = mu + beta_raw * sigma;
}
model {
beta_raw  ~ normal(0, 1);
mu ~ normal(0,10);
sigma ~ gamma(3,30);
}
``````

Is it appropriate to assign a gamma prior to sigma in this case, since I read non-centered parameterization is applied only to location-scale distribution?

Thanks!

1 Like

Yes, the usual meaning of non-centering refers to distributions in the location-scale family, especially the normal. Most distributions for strictly positive random variables have a scale or rate parameter that can be used in a similar fashion. That includes the gamma distribution. So, it may help a bit to do

``````parameters {
real beta_raw;
real mu;
real<lower=0> sigma_raw;
}
transformed parameters {
real sigma = sigma_raw / 30;
real beta = mu + sigma * beta_raw;
}
model {
beta_raw ~ normal(0, 1)
mu ~ normal(0,10)
sigma_raw ~ gamma(3, 1);
}
``````
1 Like

Thanks a lot! Is the transformation of sigma_raw recommended so as to keep all the parameters on a unit scale (while it doesn’t matter if transformed parameters are on a larger or smaller scale)?

Yes

Sorry for the repeated questions, just want to check if it is acceptable to assign a beta prior or other non-normal priors to the mu in this parameterization case? Thanks.

Acceptable to whom? I find it more acceptable than most Stan developers to put a beta prior on something (provided you declare it with `lower=0,upper=1>` if you would throw away your results otherwise. Andrew is becoming pretty insistent that you only put bounded priors on things that logically must lie within an interval, such as probabilities. But it is your prior distribution, so do what you want with it.

That gamma prior is on the standard deviation not the variance. So I’m not sure if gamma(3,30) is what you really want…