Hi everyone,

I’m struggling to implement priors on sigma when exponentiating sone components of it for the following model

y_i \sim \mathcal{N}(p_i,\sigma_i^2)

with a mean equation:

logit(p_i) = .....

and the variance equation, where n_i represents the sample size and x_1, x_2, x_3 are observed data:

\sigma_i^2 = p_i*(1-p_i)/n_i +exp(\tau_{group[i]} + \beta_{1group[i]} * x_{1i} + \beta_2*x_{2i} + \beta_{3}*x_{3group[i]})

Previously, there was no exp() function in \sigma, hence the the distribution of the mean and standard deviation was simply set to \mathcal{N}(0,0.05). But exponentiating was necessary to secure \sigma being positive.

Now I want to set priors on \tau,\beta_1, \beta_2,\ beta_3 such that they allow a 5% change, but I don’t know how to specify the priors. The model looks as follows:

```
data{
...
}
parameters{
...
// Hyper-parameters
real mu_beta1;
real<lower=0> sig_beta1;
real mu_beta2;
real<lower=0> sig_beta2;
real mu_beta3;
real<lower=0> sig_beta3;
real<lower=0> sig_tau;
// Scaled Parameters
vector[group] beta1_sc;
real beta2_sc;
real beta3_sc;
vector<lower=0>[SY] tau_sq_sc;
}
transformed parameters {
...
// Parameters
vector[group]beta1;
realbeta2;
real beta3;
vector<lower=0>[SY] tau_sq;
beta1 = mu_beta1 + sig_beta1 * beta1_sc;
beta2 = mu_beta2 + sig_beta2 * beta2_sc;
beta3 = mu_beta3 + sig_beta3 * beta3_sc;
tau_sq = sig_tau * tau_sq_sc;
}
model {
vector[N] logit_p;
vector[N] p;
...
// Hyper priors
mu_beta1 ~ normal(0,0.05);
sig_beta1 ~ normal(0,0.0.5) T[0,];
mu_beta2 ~ normal(0,0.0.5);
sig_beta2 ~ normal(0,0.0.5) T[0,];
mu_beta3 ~ normal(0,0.0.5);
sig_beta3 ~ normal(0,0.0.5) T[0,];
sig_tau ~ normal(0,0.2) T[0,];
// Priors
beta1_sc ~ normal(0,1);
beta2_sc ~ normal(0,1);
beta3_sc ~ normal(0,1);
for(i in 1:SY){
tau_sq_sc[i] ~ normal(0,1) T[0,];
}
for(i in 1:N){
logit_p[i] = ... ;
p[i] = inv_logit(logit_p[i]);
y[i] ~ normal(p[i], sqrt(p[i] * (1 - p[i]) /n[i] +
exp(tau_sq[group[i]] +
beta1[group[i]] * x1[i] +
beta2 * x2[i] +
beta3 * x3[group[i]])));
}
}
```

Would be great, if you have suggestions on how to model this and thanks a lot in advance!