Latent variables, divergent transitions and prior selection

If I set the initial value, the result can’t arrive at a convergent state.
I put the last result in the initial value of my code, after experience many times, the latent variables x_1,x_2, l_1 l_2 still have large R_hat. But the h can convergently well…If the process should be another affine model?

I’ve tried going through your model and I admit it is very hard for me to understand. I think it would be much easier to debug the model if you implemented a reduced version with similar structure (e.g. by omitting some of the latent variables or fixing them to a constant). What often happens in this type of models is that you have many different combinations of parameters providing the same or very similar predictions (this is what we call non-identifiable or weakly identifiable models). This poses a problem for Stan or any other MCMC sampler and you usually need to somehow constrain your model to actually have only one set of parameters that can produce a given pattern. Beyond really delving into the math, one can discover such problems also by playing with data simulated from the model - can you find very different values for your parameters that produce almost identical patterns in your data? An example where I did that for an ODE model is at ODE Model of Gene Regulation if that helps…

I also -noticed that the kappap and sigmap variables appear to be essentially unconstrained by the data, so that might be a hint at something that is wrong.

Hope that helps at least a little.

Very thanks for your reply~

You are right! I really find that! But I can’t solve it. When I set the initial values and set the prior variance (normal distribution) to very small. almost all parameters have Rhat accept to 1. But I think it may be a fake solution.