This RMarkdown file lists the scripts that need to be run in order to reproduce the experimental data results from the paper `Brownian motion, bridging and Bayesian inference in phylogenetic tree space’. This includes

The following shell scripts will be run and this RMarkdown shows the order to run them in order to reproduce the output of the paper.

Taxon name Integer name
Calb 1
Sbay 2
Scas 3
Scer 4
Sklu 5
Skud 6
Smik 6
Spar 8

The main inference procedure and calculation of the Fréchet mean is run using the script:

Plots from the output of the MCMC for the yeast data.:

## [1] "x0 acceptance rate  0.2480947"
## [1] "t0 acceptance rate  0.1096282"
## [1] "average bridge acceptance rate  0.632241271698113"
##   Parameter              Rate
## 1        x0         0.2480947
## 2        t0         0.1096282
## 3   bridges 0.632241271698113
## [1] "traceplot of the dispersion parameter:"

## [1] "Trace plot of the log likelihood:"

## [1] "kernel density estimate from the sampled values of dispersion:"

## [1] "t0 mode is (use this for marginal likelihoods): 0.0168927917406883"
## [1] "Plot the proportion of the top topologies in the posterior:"

## [1] "Plot of kernel density estimates of the edge lengths in the posterior:"

##                        Topology Proportion
## 1: (2,(3,(1,5)),(6,(7,(4,8))));      92.6%
## 2: ((2,6),(3,(1,5)),(7,(4,8)));       7.4%

We find a mode tree by taking the mode of the KDEs for each edge length in the modal topology in the posterior sample. After the below has been run, the mode tree is built using the script

which also calculates the total internal edge lengths on the Fréchet mean and source tree.

We now compare the distances from the mode tree to i) the data and ii) particles forward simulated under the fitted model. Particles are forward simulated under the fitted model using the script * run_yeast_posterior_checks.sh

## [1] "Plot of the BHV distances between the modal tree and the data set (bars) and the simulated particles (line)"

Now we get the value of t0 to use in the marginal likelihood calculations for the Fréchet mean. This is done by running the inference fixed at the Fréchet mean using the script:

## [1] "t0 mode is (use this for marginal liklelihoods): 0.0166780745901759"

Now it remains to run the marginal likelihood estimators with the following files: