Sigma of slope clustering to zero with NCP

I am having trouble with a model that predicts when events such as budburst or flowering occur in plants. I use the same model for all events but run the model on each set of event data separately. The slope and intercept are partially pooled for different winegrape varieties. The model runs fine with my test data but not on the real data for one of the events.

My problem is the sigma of my slope (s_bvar in my code) which had many divergent transitions and a banana in the log posterior vs the parameter plot in my original model. I tried a non-centered parameterization of the model (stan code shown). However, with the NCP, the model still has divergent transitions and the log posterior vs parameter plot now shows the slope sigma clustering towards 0.

What problem with data or my model might cause these sigma problems?

  int<lower=0> N;       //all the samples
  vector[N] x;          // year predictor
  vector[N] y;          // predicted GDD of event date
  int<lower=1> Nv;      // number of varieties
  int<lower=1, upper=Nv> variety[N]; // variety ID numbers

  vector[Nv] a_var;         
  vector[Nv] b_raw;       // slope ncp part 1
  real mu_a;              // mu, one per variety
  real mu_b;              // mu, one per var
  real<lower=0> s_avar;   // for alpha, one per var
  real<lower=0> s_bvar;   // for beta, one per var
  real<lower=0> sigma_y;  // error

transformed parameters {
  vector[Nv] b_var;
  b_var = mu_b + s_bvar * b_raw; // ncp part 2

  // likelihood
  for (n in 1:N)
  y[n] ~ normal(a_var[variety[n]] + b_var[variety[n]]*x[n], sigma_y);
  a_var ~ normal(mu_a, s_avar);
  b_raw ~ normal(0,1); 
  mu_a ~ normal(1000,500);
  mu_b ~ normal(0,5);
  s_avar ~ normal(100,50);
  s_bvar ~ normal(0,20);
  sigma_y ~ normal(0,20);

You’ve non-centered b_var but a_var is still centered. Maybe try both as non-centered?

BTW see here for easy toggling between centered/non-centered.

You might consider using the offset/multiplier syntax to account for how far away from zero some of your priors are too. That and/or scaling your predictor and outcome variables. Also, are you sure a normal observation-level structure is appropriate for your data? Event-time data like this are often modelled with more survival-associated structures.

I tried z-scoring my data without any luck but adding a non-centered a_var got rid of my divergent transitions! Thank you for the suggestions!