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

Description Usage Arguments Details Value

Description

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.

Usage

1
model_bayes_factor_n(logL1, logL2, no_samples = 100)

Arguments

logL1

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

logL2

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

no_samples

Number of permutations to sample when computing the result.

Details

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.

Value

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


admixturegraph documentation built on May 2, 2019, 6:02 a.m.