marginal_lik: Calculate marginal likelihood by thermodynamic integration...

Description Usage Arguments Value Author(s) Examples

View source: R/marginal_lik.R

Description

Calculate the marginal likelihood from a logfile generated by mcmc_bite with thermodynamic integration (Lartillot and Philippe, 2006) or stepping stone (Xie et al., 2011).

Usage

1
marginal_lik(mcmc.log, burnin = 0, method = "SS")

Arguments

mcmc.log

the output file of a mcmc_bite run

burnin

number or proportion of iteration to delete

method

one of "TI" for thermodynamic integration and "SS" for stepping stone integration (the default)

Value

a length one numeric double giving the marginal likelihood of the model.

Author(s)

Theo Gaboriau and Simon Joly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Load test data
data(Anolis_traits)
data(Anolis_tree)
data(Anolis_map)

## Run a MCMC chain with thermodynamic Integration
set.seed(300)
my.jive <- make_jive(Anolis_tree, Anolis_traits[,-3],
  model.priors = list(mean="BM", logvar="OU"))
bite_ex <- tempdir()
logfile <- sprintf("%s/my.jive_mcmc_TI.log", bite_ex)
mcmc_bite(my.jive, log.file=logfile, ncat=10, sampling.freq=10,
 print.freq=100, ngen=1000, burnin=0) 
 
## import the results in R
res <- read.csv(logfile, header = TRUE, sep = "\t")
 
mlikTI <- marginal_lik(res, burnin = 0.1, method = "TI")
mlikTI

mlikSS <- marginal_lik(res, burnin = 0.1, method = "SS")
mlikSS

bite documentation built on April 22, 2020, 5:09 p.m.

Related to marginal_lik in bite...