Hi all,
I’m trying to specify a hierarchical multivariate probit model based off the example in the manual. I’m having some problems. Initially, I was also including (strongly regularised) group level covariates, but the model wouldn’t at all initialise, so I took them out and tried to work out what the minimal model I could get to run was, as per other advice I’ve seen on this forum. I’m initialising values generated from from univariate runs of the same dataset. The model now runs, with the standard Jacobian warning, but I’m 90% sure that I’m not doing any non-linear transformations of the variables. But it’s mixing --terribly-- (the log posterior doesn’t seem to be getting near convergence at all), and I’m getting a low BFMI.
I was wondering if anyone would be willing to point me in the right direction towards spotting what the issue is here so I can have a go at fixing it, then hopefully I can add the group level covariates back in and break it all over again!
Model, data, traceplot and R code attached. Apologies for the messiness of the code, I’m pretty new to stan coding. (I could only put a single attachment up, so here’s everything in a dropbox link https://www.dropbox.com/sh/7f63of1r3nrshw9/AAC0co2lY_At75_qQZ9UEwwQa?dl=0)
I couldn’t follow the moves in the transformed parameters block. I just don’t see the multivariate probit structure.
You’re right you’re not doing any non-linear transforms—you’re just shuffling elements around in the transformed parameters.
These models are very hard to fit, so you often need tight priors. Your LKJ prior isn’t doing anything — a parameter value of 1 is just uniform, and you get that for free. The Cauchy priors are very wide on the sigmas—you might try replacing those with tighter normals.
The biggest issue is that you want to move muL
and muS
to a non-centered parameterization.
You can vectorize the computation of beta_x
as just beta_x = alpha + muS[S] + muL[L];
Then I’d suggest just dropping it in the location argument position of the multi_normal rather than building a whole new block here. (Sorry if you copied this from a model that wasn’t up to our current standards—we still haven’t caught up going through the manual.)
P.S. These “here’s a link, help me debug” questions don’t get answered very quickly because they’re time consuming. I do understand the problem you have if you’re just starting trying to formulate a crisp question—just wanted to let you know why this wasn’t getting answered.
Also, dropbox’s interface is super clunky for me on the Mac in Safari—it just auto picks where to drop files and I have to go fish them out.
Thanks very much for the help!
Yeah, that model was based on the one in the manual, probably most of the bad additions were me though. All the transformed parameter stuff was from in there, I actually managed to fix most of the issues that I was having using the other parameterisation of the multivariate probit that I found in the Stan example models on the github page. It seems a tad numerically unstable and only avoids divergences at really high adapt delta, but it seems to pass every test otherwise.
Also, sorry about the dubugging question, I’ve learnt a lot, very quickly, in the last week just jumping into the fire.
Yes, I’m afraid multivariate probit isn’t very numerically stable. Let us know if you come up with a better parameterization.