bridge_sampler.angmcmc {BAMBI}R Documentation

Log Marginal Likelihood via Bridge Sampling for angmcmc objects

Description

Log Marginal Likelihood via Bridge Sampling for angmcmc objects

Usage

## S3 method for class 'angmcmc'
bridge_sampler(samples, ..., ave_over_chains = TRUE)

Arguments

samples

angmcmc object

...

additional argument passed to bridge_sampler. Note that default for the argument method is "warp3", (instead of "normal" as used in bridgesampling package) to account for multi-modality of the posterior density.

ave_over_chains

logical. Separately call bridge_sampler on each chain in the angmcmc object and then take the average? Defaults to TRUE. See details.

Details

Marginal likelihood is calculated by first converting the angmcmc object samples to an mcmc.list object, and then by passing the resulting mcmc.list object to bridge_sampler. If variablity across multiple chains (if any) are very different, then calling bridge_sampler separately for each chain usually provides more stable results; the final log ML is computed by averaging over chain specific MLs.

Examples


library(future)
library(parallel)
# plan(multisession, gc = TRUE) # parallelize chains

set.seed(100)
MC.fit <- fit_angmix("vmsin", tim8, ncomp=3, n.iter=5000,
                     n.chains = 3)


library(bridgesampling)
bridge_sampler(MC.fit)



[Package BAMBI version 2.3.5 Index]