bayes.factors | R Documentation |
Calculate Bayes factors and posterior model probabilities
bayes.factors(..., prior = NULL, boot = TRUE, n = 10000, prob = 0.95)
... |
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 |
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
.
A list with elements bf
and logbf
, the Bayes factors and
log-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
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.