How to make sure multiplier is above zero

my model is as follows,

\begin{align*} &\Pr(y = 1) = \text{logit}^{-1}(\text{predictor}) \\ &\text{predictor} = \alpha + \beta_{\text{province}} + \gamma_{\text{age}} + \delta_{\text{gender}} + \epsilon_{\text{hukou}} + \text{income}[\text{province}] * \psi \\ &\quad\quad\quad\quad + \text{edu}[\text{province}] * \eta + \zeta_{\text{area}[\text{province}]} \\ &\{\alpha, \psi, \eta\} \sim \text{normal}(0, tau1) \\ &\beta \sim \text{normal}(0, \sigma_\beta) \\ &\gamma \sim \text{normal}(0, \sigma_\gamma) \\ &\delta \sim \text{normal}(0, \sigma_\delta) \\ &\epsilon \sim \text{normal}(0, \sigma_\epsilon) \\ &\zeta \sim \text{normal}(0, \sigma_\zeta) \\ &\text{sum}(\delta) \sim \text{normal}(0, 0.001) \\ &\text{sum}(\epsilon) \sim \text{normal}(0, 0.001) \\ &\{\sigma_\beta, \sigma_\gamma, \sigma_\delta, \sigma_\epsilon, \sigma_\zeta\} \sim \text{normal}(0, tau2) \end{align*}

my stan codes are as follows,

data {
  int<lower=0> N;  // sample size
  array[N] int<lower=1, upper=30> state;  // province
  array[N] int<lower=1, upper=6> age;  
  array[N] int<lower=1, upper=2> gender, urban;  
  array[N] int<lower=0, upper=1> y;  // dependent variable
  array[30] real<lower=0> income, edu;  
  array[30] int<lower=1, upper=3> area;  // area:east,west and middle
  array[30, 6, 2, 2] int<lower=0> P;  
  real tau1,tau2;
}

parameters {
  real alpha,psi,eta;  
  real<lower=0> sigma_beta, sigma_gamma, sigma_delta, sigma_epsilon, sigma_zeta;
  vector<multiplier=sigma_beta>[30] beta;  // provinces
  vector<multiplier=sigma_gamma>[6] gamma;  // age groups
  vector<multiplier=sigma_delta>[2] delta;  // gender
  vector<multiplier=sigma_epsilon>[2] epsilon;  // urban/rural
  vector<multiplier=sigma_zeta>[3] zeta;  // area:east,west and middle
}

model {
  vector[N] linear_predictor;

  for (i in 1:N) {
    linear_predictor[i] = alpha + beta[state[i]] + gamma[age[i]] +
     delta[gender[i]] + epsilon[urban[i]] +
      income[state[i]] * psi + edu[state[i]] * eta + zeta[area[state[i]]];
  }
  
  // likelihood function
  y ~ bernoulli_logit(linear_predictor);
  
  // the prior of fixed effect
  {alpha, psi, eta} ~ normal(0,tau1);
  
  // the prior of random effect
  beta ~ normal(0, sigma_beta);
  gamma ~ normal(0, sigma_gamma);
  delta ~ normal(0, sigma_delta);
  epsilon ~ normal(0, sigma_epsilon);
  zeta ~ normal(0, sigma_zeta);
  // two-value categorical variable
  sum(delta) ~ normal(0, 0.001);
  sum(epsilon) ~ normal(0, 0.001);
  
  // the prior of hyperparameters
  {sigma_beta, sigma_gamma, sigma_delta, sigma_epsilon, sigma_zeta} ~ normal(0,tau2)T[0, ];

}

The result is not good. a message always occurs:
The current Metropolis proposal is about to be rejected because of the following issue:
Exception: offset_multiplier_constrain: multiplier is 0, but must be positive finite!

I believe the issue lies in the last line ( {sigma_beta, sigma_gamma, sigma_delta, sigma_epsilon, sigma_zeta} ~ normal(0,tau2)T[0, ];). how to address it?

Although you’re imposing the constraint that the multipliers are zero or greater it may be that they are very small negative numbers, which will thrown an error (they could be exactly zero, but it’s less likely, since it’s a single infinitesimal point).

You can try and make sure that is not happening by printing out the values, and if needed setting them to zero if they turn out to be negative, or doing something to handle the case when it is zero (e.g. having a transformed parameter that can be zero, unlike the original value with the multiplier which must be greater than).

I’m not sure what you mean that this line would cause, but you could try to separate them into separate lines, one for each real parameter. It seems to me that it will make no difference, except for making it a bit more readable.

good idea, i will try following your advice.