Hi @gavinsimpson,
Firstly, great work getting posterior_samples into such great shape. It is a shame that {mgcv} doesn't already have handy functions to simulate on the outcome scale, this functionality is badly needed. I'm not sure what your long-term plans are, but to me it seems sensible to use these capabilities to make the huge list of ppc and ppd functions from {bayesplot} available for {mgcv} and friends. I've just done this for {mvgam} and it is surprisingly easy, once you have the simulation functions already available (as always, the code in {brms} provides an excellent template).
Of course it doesn't have to stop there. With appropriate simulation functions for a wide range of families, you could incorporate a more useful loglik() function that returns posterior draws of the density. This would make {loo} functionality available, which is not only handy for model comparisons but for many other purposes (see for example my answer to this CV post). I realise you probably don't want to bring in too may dependencies and you probably have your own directions to head, so if you aren't keen on this then no big deal. But I'd be happy to lead some of it if you're willing to accept PRs.
Hi @gavinsimpson, Firstly, great work getting
posterior_samples
into such great shape. It is a shame that {mgcv
} doesn't already have handy functions to simulate on the outcome scale, this functionality is badly needed. I'm not sure what your long-term plans are, but to me it seems sensible to use these capabilities to make the huge list ofppc
andppd
functions from {bayesplot
} available for {mgcv
} and friends. I've just done this for {mvgam
} and it is surprisingly easy, once you have the simulation functions already available (as always, the code in {brms
} provides an excellent template).Of course it doesn't have to stop there. With appropriate simulation functions for a wide range of families, you could incorporate a more useful
loglik()
function that returns posterior draws of the density. This would make {loo
} functionality available, which is not only handy for model comparisons but for many other purposes (see for example my answer to this CV post). I realise you probably don't want to bring in too may dependencies and you probably have your own directions to head, so if you aren't keen on this then no big deal. But I'd be happy to lead some of it if you're willing to accept PRs.