# Unique chain behaving strangely

I am running a probit model and I have a variable that is sampled as a half-normal as follows:

blockSD \sim \mathcal{N}(0.1,0.1), \text{ with } blockSD>0 \\ blockDeviation \sim \mathcal{N}(0,blockSD)

However, when running this sometimes I see something that I had never seen before, for example, if I look at a graph of blockSD vs blockDeviation (please ignore the “_a’s” after the name), and mark the divergences in red I see the following:

When I looked at this more closely, I saw that chain 3 of the sampler basically stays around 4:

summary(as.numeric(fit\$draws(variables=“blockSD_a”)[,3,]))
Min. 1st Qu. Median Mean 3rd Qu. Max.
4.838 4.854 4.858 4.858 4.862 4.875

Whereas the other 3 chains sample fine as shown in the graph.

Does this make any sense? I will deal with this by setting

real<lower=0,upper=0.4> blockSD;


Which is faithful to the fact that blockSD would never go beyond 0.4.

However, I had never seen this behavior, does this make any sense?

It really helps if you give us Stan code and not just a fragment of math. I’m assuming your block of math translates into Stan this way, with simplified names:

parameters {
real<lower=0> sigma;
vector[N] delta;
}
model {
sigma ~ normal(0.1, 0.1);
delta ~ normal(0, sigma);
}


This can be problematic for sampling because it uses a centered parameterization. You almost always want to code this as follows instead using a non-centered parameterization (we discuss this in the user’s guide chapter on regression and hierarchical models):

parameters {
real<lower=0> sigma;
vector<multiplier=sigma>[N] delta;
}
model {
sigma ~ normal(0.1, 0.1);
delta ~ normal(0, sigma);
}


Impossible to say without seeing the rest of your Stan program. I’d suggest running lots of chains and seeing if others get stuck.

If the problem persists and you know the values are lower, then you probably want to shrink them rather than impose a hard boundary. If you do impose a hard boundary and probability mass piles up near the boundaries, you’ll know the data isn’t consistent with the constraint.