The bridgesampling package facilitates the computation of the marginal likelihood for a wide range of different statistical models. For models implemented in Stan (such that the constants are retained), executing the code bridge_sampler(stanfit) automatically produces an estimate of the marginal likelihood.

Full story is at the link.

Yes but why should it?

(My standard advice to people is “If you’re name is Jim Berger or you self identify as an expert in Bayes factors, then by all means use them. Otherwise they’re really really hard to do well.”)

What about forensic likelihood ratios? I think that’s a very legtimate use of bayes factors, and this package could be very useful there.

As I said, if you self-identify as an expert in BFs then use them. But you need to understand just about everything about your model (and particularly your prior), to know which parts of your model the BF will be sensitive to, and have iron clad justifications of those parts of the model. This is not really a “entry level” tool. Without those things, BFs are too easy to game.

I would have said the same thing before the bridgesampling package was introduced. It makes calculating these things easy and come with error estimates.