I want to calculate loo for a multinomial regression model. This particular case is a linear model in isometric logratio coordinates, with overdispersion modelled by a multivariate normal in logratio coordinates. We have 125 observations, each of which can be described by a multinomial on 10 categories, with a total count of about 100 for each observation. We have 72 parameters (3 9-dimensional regression coefficient vectors and a 9-dimensional covariance matrix).
I’m getting log_lik values typically around -10. If we had a uniform model, the log_lik would be 100 log(1 / 10), which is about -230. So our model appears to be much better than a uniform model (and graphically, it looks like a good description of the data). But the Pareto k diagnostics are bad:
Followup: given those apparent problems with loo, to what extent can I trust the results of model comparisons? I compared linear, quadratic and cubic models using compare() in loo. For all three models, more than 70% of the Pareto k were greater than 1. Nevertheless:
cubic vs quadratic:
quadratic vs linear:
Plotting the posterior means (with 95% HPD intervals for the quadratic model) suggests that the quadratic model is clearly better than the linear model, but there isn’t much to choose between cubic and quadratic. That seems consistent with the results of compare().
Correction: it’s 9 categories, not 10 (I’d forgotten which problem I was working on), so 60 parameters, and a uniform model would give log_lik around 100 log(1 / 9), which is about -220. Doesn’t change things much.
I had feared that might be the case. The context is that a reviewer asked us to determine whether quadratic and cubic terms are needed. I think it’s fairly obvious from the plots that a linear model alone is not adequate, and that a cubic isn’t much better than a quadratic. We also have biological reasons for expecting at least a quadratic. Nevertheless, reviewers may not think that just looking at graphs is enough. Is there any easy way to satisfy them? For example, we could probably compute Bayes factors using the bridgesampling package, although the documentation suggests that we would need to rewrite our stan code to include constants.
I’d also like to understand why loo didn’t work well in this case.
The whole linear vs. quadratic vs. cubic thing is a bit of a forced choice and one where it is hard to be confident any one of them is true in order to justify calculating model probabilities via a Bayes Factor. I would do a spline and then see if it is acceptably close to a polynomial. I also don’t do Cauchy distributions.
Also, in your case it seems as if your observations are stills and the LOO concept you are using means “What if I were to omit still i?” If you are thinking about the predictive ability of the model for an unobserved still — as opposed to future data on an already observed still — then you should be integrating the still-specific parameters out to form a new likelihood function. Details at
Yes, predicting a new still is much more relevant than new data from an already-observed still (here, a still is a single frame from a video transect, with the organisms present at about 100 randomly-chosen points on each still forming a multinomial sample).
The StanCon talk was great. I think I can see what I need to do now, although I’m not sure that I will actually be able to do it in the limited time available. It does seem as though approximating the marginal density might be quite a lot of work, and easy to get wrong.
Yes. You have more parameters than observations and only a weak prior in those parameters. For each still you have own z, and so the model can fit very well, but if you remove an observation the prior z[i] ~ normal(0, 1); is too much different than the posterior. Thus PSIS-LOO estimates are way too optimistic and Pareto-k diagnostic is correctly seeing the problem.
The model I think I’m fitting is hierarchical, with still-specific intercepts drawn from a multivariate normal(0, Sigma) distribution to deal with overdispersion. I wanted an LKJ prior on Sigma having hyperparameters tau (scale factor) and LOmega (Cholesky factor of covariance matrix). I thought that such a model was identifiable (if you treat the still-specific intercepts as latent variables rather than parameters), and I have checked with simulated datasets that we can recover Sigma as well as the coefficients Beta. If I integrate out the still-specific intercepts to get a marginal likelihood (as Ben suggested), so that the number of parameters does not increase with the number of stills, is PSIS-LOO likely to work?
Yes, other parameters than the the still-specific intercepts can be well identified and there is no problem of using your model for predictions etc. but IS-LOO has the weakness that it doesn’t work well if observations are highly influential for some parameters (as now is the case of for still-specific intercepts).