### File: timetree tutorial Bayes factor batch file
### Compares 2 different relaxed clock models on a fixed tree (after power posteriors are run)
### First we get estimates of marginal likelihoods from a file containing power posterior distributions
### It then calculates the Bayes factor for each pair-wise comparison
### Using the stepping-stone sampler, calculate the marginal likelihoods for each model from the power posteriors
ss_GMC = steppingStoneSampler(file="output/GMC_bears_powp.out", powerColumnName="power", likelihoodColumnName="likelihood")
ss_UCLN = steppingStoneSampler(file="output/UCLN_bears_powp.out", powerColumnName="power", likelihoodColumnName="likelihood")
mLnL_m0 <- ss_GMC.marginal()
mLnL_m1 <- ss_UCLN.marginal()
### pairwise comparisons of each model using Bayes factors
BF_01 <- mLnL_m0 - mLnL_m1
"BF_01"
BF_01