All versions of the 12-parameter model were run using 8 chains with 84,000 iterations each with a burn-in of 4000 iterations (with a thinning factor of 10, for a total of 64000 samples). The full 24-parameter model was run similarly, but for 144,000 steps.

source("R/utils.R")
source("R/mcmc.R")
source("R/functions.R")
source("R/monitornew.R")
load_pkgs()
zmargin <- theme(panel.spacing = grid::unit(0, "lines"))
theme_set(theme_bw())
library(targets)

fishphylo

This is the model that uses only the full/known phylogeny. (Probably irrelevant.)

tar_load(traceplot_0)
print(traceplot_0)

tar_load(ag_mcmc0)
aa <- do.call(abind, c(ag_mcmc0, list(along=3)))
aa2 <- aperm(aa,c(1,3,2), resize=TRUE)
monitor(aa2)
## Inference for the input samples (8 chains: each with iter = 8000; warmup = 0):
## 
##                   Q5  Q50  Q95 Mean   SD  Rhat Bulk_ESS Tail_ESS
## loss.sc         4.02 4.65 5.18 4.63 0.35  1.00    10622    17905
## loss.pc         4.26 4.73 5.12 4.71 0.26  1.00    14810    22222
## loss.ag_pc0_sc0 2.53 4.15 5.59 4.11 0.93  1.00     2487     5658
## gain.sc         4.85 5.13 5.38 5.12 0.16  1.00    22389    33882
## loss.ag_pc0_sc1 2.36 4.31 6.72 4.39 1.32  1.01     1145     1616
## gain.pc         3.55 3.92 4.27 3.92 0.22  1.00    18144    30749
## loss.ag_pc1_sc0 3.82 4.58 5.20 4.55 0.42  1.00    10012    18798
## loss.ag_pc1_sc1 2.18 3.60 4.78 3.56 0.80  1.00     2438     5462
## gain.ag_pc0_sc0 1.54 2.53 3.30 2.49 0.54  1.00     6066    13184
## gain.ag_pc0_sc1 0.31 1.66 2.87 1.64 0.79  1.00     1787     2417
## gain.ag_pc1_sc0 3.53 4.25 4.84 4.23 0.40  1.00    11159    18553
## gain.ag_pc1_sc1 1.00 2.70 4.26 2.67 1.00  1.00     1590     5276
## 
## For each parameter, Bulk_ESS and Tail_ESS are crude measures of 
## effective sample size for bulk and tail quantities respectively (an ESS > 100 
## per chain is considered good), and Rhat is the potential scale reduction 
## factor on rank normalized split chains (at convergence, Rhat <= 1.01).
tar_load(mc_pairsplots_0)
knitr::include_graphics('pix/mcmc_pairs_0.png')

Contour levels are: 50%, 80% 90%, 95% (largest) highest posterior density regions.

treeblock

The model that samples over the ‘tree block’ (sample of phylogeny reconstructions)

tar_load(traceplot_tb)
print(traceplot_tb)

tar_load(ag_mcmc_tb)
aa <- do.call(abind, c(ag_mcmc_tb, list(along=3)))
aa2 <- aperm(aa,c(1,3,2), resize=TRUE)
monitor(aa2)
## Inference for the input samples (8 chains: each with iter = 8000; warmup = 0):
## 
##                   Q5  Q50  Q95 Mean   SD  Rhat Bulk_ESS Tail_ESS
## loss.sc         4.32 4.89 5.40 4.88 0.33  1.00     9389    17853
## loss.pc         4.45 4.87 5.23 4.86 0.24  1.00    15936    26910
## loss.ag_pc0_sc0 2.45 4.10 5.62 4.07 0.96  1.01     1691     3050
## gain.sc         4.98 5.24 5.48 5.23 0.15  1.00    20255    33733
## loss.ag_pc0_sc1 2.34 4.35 6.81 4.43 1.35  1.01     1147     1838
## gain.pc         3.60 3.97 4.31 3.96 0.22  1.00    17269    30483
## loss.ag_pc1_sc0 4.07 4.76 5.32 4.73 0.38  1.00     8256    14982
## loss.ag_pc1_sc1 2.25 3.69 4.92 3.65 0.81  1.00     1816     4835
## gain.ag_pc0_sc0 1.36 2.41 3.21 2.36 0.57  1.00     3634     7091
## gain.ag_pc0_sc1 0.33 1.69 2.91 1.67 0.79  1.01     2147     2583
## gain.ag_pc1_sc0 4.22 4.81 5.28 4.78 0.33  1.00     9932    11580
## gain.ag_pc1_sc1 1.03 2.76 4.38 2.74 1.01  1.00     2020     4283
## 
## For each parameter, Bulk_ESS and Tail_ESS are crude measures of 
## effective sample size for bulk and tail quantities respectively (an ESS > 100 
## per chain is considered good), and Rhat is the potential scale reduction 
## factor on rank normalized split chains (at convergence, Rhat <= 1.01).
tar_load(mc_pairsplots_tb)
knitr::include_graphics('pix/mcmc_pairs_tb.png')

full

tar_load(traceplot_full)
print(traceplot_full)

tar_load(ag_mcmc_full)
aa <- do.call(abind, c(ag_mcmc_full, list(along=3)))
aa2 <- aperm(aa,c(1,3,2), resize=TRUE)
monitor(aa2)
## Inference for the input samples (8 chains: each with iter = 13600; warmup = 0):
## 
##                    Q5   Q50  Q95  Mean   SD  Rhat Bulk_ESS Tail_ESS
## ag0_pc0_loss.sc  4.00  4.63 5.17  4.61 0.36  1.00    10591    23551
## ag0_loss.pc_sc0  4.22  4.70 5.11  4.68 0.27  1.00    22411    35772
## loss.ag_pc0_sc0  2.47  4.09 5.57  4.06 0.94  1.00     2630     8505
## ag0_pc0_gain.sc  4.82  5.11 5.37  5.10 0.17  1.00    27148    43068
## ag0_loss.pc_sc1  2.42  4.44 7.05  4.55 1.39  1.01     1542     2880
## loss.ag_pc0_sc1  3.48  3.87 4.23  3.86 0.23  1.00    24062    45025
## ag0_gain.pc_sc0  3.83  4.59 5.22  4.56 0.42  1.00    10475    21721
## ag0_pc1_loss.sc  2.07  3.55 4.77  3.50 0.82  1.00     3404     7931
## loss.ag_pc1_sc0  1.36  2.43 3.25  2.38 0.58  1.00     4669    10132
## ag0_gain.pc_sc1  0.34  1.69 2.95  1.68 0.80  1.01     2310     3621
## ag0_pc1_gain.sc  3.38  4.16 4.77  4.13 0.43  1.00    10465    14993
## loss.ag_pc1_sc1  0.89  2.57 4.10  2.54 0.98  1.00     2480     7374
## gain.ag_pc0_sc0 -1.19 -0.09 0.77 -0.13 0.60  1.00     3977     7728
## ag1_pc0_loss.sc  1.96  4.26 6.56  4.26 1.40  1.01     1105     3436
## ag1_loss.pc_sc0  1.92  4.21 6.47  4.20 1.38  1.01     1439     4393
## gain.ag_pc0_sc1  2.02  4.27 6.56  4.28 1.38  1.00      878     2147
## ag1_pc0_gain.sc  1.88  4.26 6.55  4.24 1.42  1.01     1040     2628
## ag1_loss.pc_sc1  1.86  4.18 6.50  4.18 1.41  1.01      918     2721
## gain.ag_pc1_sc0  2.02  4.35 6.58  4.33 1.39  1.01      905     2427
## ag1_gain.pc_sc0  1.79  4.23 6.62  4.22 1.46  1.01      531      892
## ag1_pc1_loss.sc  1.98  4.28 6.59  4.29 1.40  1.00     1129     3046
## gain.ag_pc1_sc1  1.88  4.18 6.44  4.17 1.39  1.00     1609     4535
## ag1_gain.pc_sc1  1.95  4.27 6.65  4.29 1.43  1.01      925     1387
## ag1_pc1_gain.sc  1.92  4.21 6.52  4.21 1.40  1.01     1052     2711
## 
## For each parameter, Bulk_ESS and Tail_ESS are crude measures of 
## effective sample size for bulk and tail quantities respectively (an ESS > 100 
## per chain is considered good), and Rhat is the potential scale reduction 
## factor on rank normalized split chains (at convergence, Rhat <= 1.01).
tar_load(mc_pairsplots_full)
knitr::include_graphics('pix/mcmc_pairs_full.png')

no_gainloss

tar_load(traceplot_tb_nogainloss)
print(traceplot_tb_nogainloss)

tar_load(ag_mcmc_tb_nogainloss)
aa <- do.call(abind, c(ag_mcmc_tb_nogainloss, list(along=3)))
aa2 <- aperm(aa,c(1,3,2), resize=TRUE)
monitor(aa2)
## Inference for the input samples (8 chains: each with iter = 8000; warmup = 0):
## 
##                   Q5  Q50  Q95 Mean   SD  Rhat Bulk_ESS Tail_ESS
## loss.sc         4.19 4.88 5.44 4.86 0.38  1.00     7946    12637
## loss.pc         4.50 4.92 5.29 4.92 0.24  1.00    17867    28501
## loss.ag_pc0_sc0 1.66 3.79 5.54 3.71 1.19  1.01     1147     1783
## gain.sc         4.96 5.23 5.48 5.23 0.16  1.00    18822    21039
## loss.ag_pc0_sc1 2.09 4.94 8.01 5.00 1.79  1.02      679     1864
## gain.pc         3.50 3.90 4.26 3.89 0.23  1.00    18795    31224
## loss.ag_pc1_sc0 3.81 4.61 5.22 4.58 0.44  1.00    11963    16471
## loss.ag_pc1_sc1 1.31 3.18 4.69 3.11 1.03  1.01     1817     2968
## gain.ag_pc0_sc0 1.41 2.47 3.26 2.42 0.57  1.00     5747     8859
## gain.ag_pc0_sc1 0.17 1.69 3.01 1.65 0.87  1.01     1625     2567
## gain.ag_pc1_sc0 4.31 4.87 5.33 4.85 0.32  1.00    14195    22231
## gain.ag_pc1_sc1 1.52 3.49 5.04 3.42 1.08  1.00     1722     3046
## 
## For each parameter, Bulk_ESS and Tail_ESS are crude measures of 
## effective sample size for bulk and tail quantities respectively (an ESS > 100 
## per chain is considered good), and Rhat is the potential scale reduction 
## factor on rank normalized split chains (at convergence, Rhat <= 1.01).
tar_load(mc_pairsplots_tb_nogainloss)
knitr::include_graphics('pix/mcmc_pairs_tb_nogainloss.png')