model_bayes_factor_n: Computes the Bayes factor between two models from samples...

Description Usage Arguments Details Value

View source: R/mcmc.R


The likelihood of a graph can be computed by integrating over all the graph parameters (with appropriate priors). Doing this by sampling from priors is very inefficient, so we use samples from the posteriors to importance sample the likelihood. Given two graphs, and samples from their posteriors, we can estimate the Bayes factor between them.


model_bayes_factor_n(logL1, logL2, no_samples = 100)



Samples of log likelihoods from the posterior distribution of the first graph.


Samples of log likelihoods from the posterior distribution of the second graph.


Number of permutations to sample when computing the result.


The numerical issues with adding a lot of numbers in log space is unstable so we get a better estimate by doing it several times on different permutations of the data. This function calculates the mean of the Bayes factors over different permutations of the input and estimates the standard deviation.


The Bayes factor between the two graphs given as the mean and standard deviation over no_samples different permutations of the input.

mailund/admixture_graph documentation built on April 3, 2018, 9:28 p.m.