Dear Stan team/users,
I'm updating the previous post as I think I've managed to fix my issue and thought that it could be useful to other beginners. (tldr: used the "non-centered" Matt trick)
My first mistake was to assume that because an earlier/simpler model could successfully recover parameters from surrogate data, then I could continue building on more complicated models without further checks and that I'd be ok (how wrong I was!).
To attempt to fix my problem:
I regenerated surrogate data for that more complex model, then tried to reparametrize the model using different alternatives until it worked (thankfully it worked before I ran out of alternative reparametrizations):
First I tried to rescale the inputs by normalizing them (z-scored). It seems to have helped a bit as the chains were mixing a bit better than before but still eventually got stuck sometimes with low "accept_stat__" & "tree_depth__".
Then I attempted to use the non-centered (Matt Trick):
1) First I tried the Matt trick on subject-level parameters while keeping the initial hyperpriors on different scale/locations. That worked okay-ish, but not perfectly.
2) Then tried the Matt trick but removed nearly all lower and upper constraint on parameters, all parameters centered on zero with unit variance. -- Mixing was now working really well and no divergent traces! However parameters recovered were not as good as these recovered from previous attempt with hyperparameters on different scales/locations (my assumption then was that my hyperpriors were too tight).
3) Tried Matt trick, again without upper lower constraints on parameters, centered on zero but with wider variance (i.e. N(0,10) & Cauchy(0,2.5)). -- This worked like a charm in terms of both mixing & parameter recovery (K-ching!)
4) Then fit the model to real data, and the mixing issues were gone there too (attached) :)
In retrospect, I learnt that it'd always be worth checking that the most complex model from a set of models can also recover parameters from surrogate data, then simpler models deriving from the complex one should also be ok.
I guess my mistake was to use the "start simple & build up" motto too literally, and I then forgot to check whether things got wrong along the way.
---
Now however, I'm still left relatively puzzled as to how/why this trick works at all!? (Please forgive me if this is really naive)
I feel like by using Matt's trick, I'm only moving the scale/location problem from the model block up to the transformed parameter block, but the parameters are essentially the same then?!
Also: Why is "non-centered" Matt-trick called "non-centered"? Maybe this is related to my previous question about not understanding what the Matt trick does, as once reparametrized, the parameters are now all at the same location in the model_block (i.e. "centered" on zero)?
Finally, I've seen other scripts using Matt-trick together with Phi_approx() or Phi() in the transformed parameter block.
I assume to force a parameter to be in between [0 and 1] or [0 and any Number] by adding a constant (please correct me if I'm wrong).
But what would be the benefit of, say, using N(0,1) then -> phi_approx( mu + sd * N(0,1)) vs. using directly a Beta distribution in the model block?
Also just wanted to say thank you so much to the community, Stan is amazing!
Best,