# bayes.factors: Calculate Bayes factors and posterior model probabilities In dosreislab/mcmc3r: Tools to work with MCMCTree

## Description

Calculate Bayes factors and posterior model probabilities

## Usage

 ```1 2``` ```bayes.factors(..., prior = NULL, boot = TRUE, n = 1000, prob = 0.95) ```

## Arguments

 `...` list of marginal likelihood objects, see details `prior` numeric, the prior model probabilities `boot` logical, whether to perform parametric boostrap of probabilities `n` numeric, number of bootstrap samples `prob` numeric, the probability used to calculate the boostrap CI

## Details

Input is a list of marginal likelihood objects, with each object generated by either `stepping.stones()` or `gauss.quad()`. If ```boot = TRUE```, parametric bootstrap is performed by assuming the log-marginal likelihood estimates are normally distributed with standard deviation equal to the standard error. The re-sampled `n` marginal log-likelihoods are used to estimate re-sampled posterior probabilities, and to calculate an equal-tail bootstrap confidence interval for these.

Note that the length of `prior` should be the same as the number of models being compared. The `prior` is rescaled so that `sum(prior) == 1`.

## Value

A list with elements `bf`, the Bayes factors; `pr`, the posterior model probabilities; `prior` the prior model probabilities and, if `boot = TRUE`, `pr.ci` the equal-tail bootstrap confidence interval.

Mario dos Reis

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```# See Table 5 in dos Reis et al. (2018, Syst. Biol., 67: 594-615) # Bayesian selection of relaxed clock models for the 1st and 2nd sites # of mitochondrial protein-coding genes of primates # Models: strick clock, independent-rates, and autocorrelated-rates sc <- list(); sc\$logml <- -16519.03; sc\$se <- .01 ir <- list(); ir\$logml <- -16480.58; ir\$se <- .063 ar <- list(); ar\$logml <- -16477.82; ar\$se <- .035 bayes.factors(sc, ir, ar) bayes.factors(sc, ir, ar, prior=c(.25,.5,.25)) bayes.factors(sc, ir, ar, prior=c(0,1,0)) ```

dosreislab/mcmc3r documentation built on Oct. 20, 2018, 2:41 a.m.