Bridgestan and Bridgesampling

Has anyone had any luck with using the log_density() from an instantiation of bridgestan as the log_posterior argument in bridge-sampler? I have been using bridgestan for some downstream prediction analyses and post-hoc slice sampling and I am trying to use the marginal log likelihood in validation and comparison. I think the issue is when I instantiate a bs model I include the data, but then there is an additional data argument in the bridge-sampler call.

Any suggestions?

I’m not very familiar with bridgesampling, does the data change? If so you could define a custom log_posterior function which instantiates a BridgeStan model and then calls it once, but this will be pretty expensive.

If the data is constant you can write a custom function that just ignores the data argument and calls the normal bridgestan functions

Is that a reference to a package somewhere?

BridgeStan itself doesn’t do any marginalization, so I’m not sure what you mean by marginal log likelihood. The usual place that comes up with Stan is with latent discrete parameters which have to be manually marginalized out.

I think this is a reference to this package: bridgesampling source: R/bridge_sampler.R

paper on arxiv: [1710.08162] bridgesampling: An R Package for Estimating Normalizing Constants

Statistical procedures such as Bayes factor model selection and Bayesian model averag- ing require the computation of normalizing constants (e.g., marginal likelihoods). These normalizing constants are notoriously difficult to obtain, as they usually involve high- dimensional integrals that cannot be solved analytically. Here we introduce an R package that uses bridge sampling (Meng and Wong 1996; Meng and Schilling 2002) to estimate normalizing constants in a generic and easy-to-use fashion. For models implemented in Stan, the estimation procedure is automatic. We illustrate the functionality of the package with three examples.