Sunday, April 12, 2020

Significant updates to threshBayes for the correlational threshold model

Today I pushed various updates to the function threshBayes in phytools (1, 2, 3, 4). threshBayes uses Bayesian MCMC to fit the correlational threshold model of Felsenstein (2012).

In short, the threshold model is a model in which we assume that our observed discrete trait is underlain but an observed continuous character called liability. Whenever the value of liability crosses a threshold, the discrete character changes in state. The threshold model was originally introduced to quantitative genetics by Sewall Wright. The neat thing about it in a phylogenetic comparative context is that it makes the correlation between discrete characters really easy to define - merely as the correlation of their liabilities. (Likewise, we define the correlation between a continuous and a discrete trait as the correlation between the values for the continuous trait and the liabilities of the discrete character.)

The way that that threshBayes works is by sampling the liability values at the tips of the tree as well as the parameters of our evolutionary model (\(\sigma\)2^ for any continuous trait, ancestral states, and the correlation between the characters, r) from their joint posterior probability distribution using MCMC. The problem is that this is a very high dimensional space so the MCMC can be quite inefficient.

Following what I did last week with mcmcMk, the main feature that I added is the capability to automatically tune the proposal distributions to a target acceptance rate, which defaults to 0.234. In addition, I also added some new S3 methods for plotting and for computing & graphing the posterior density.

Auto-tuning the proposal distributions to our target acceptance ratio does seem to help us converge on the posterior more efficiently, particularly if we have lots of data (i.e., a tree with lots of tips).

Here's a quick demo using some simulated data.

Load packages:

library(phytools)
packageVersion("phytools")
## [1] '0.7.27'

Simulate data:

tree<-pbtree(n=200)
X<-as.data.frame(sim.corrs(tree,matrix(c(1,0.7,0.7,1),2,2)))
X[[2]]<-as.factor(threshState(X[[2]],setNames(c(0,Inf),c("A","B"))))
Y<-as.data.frame(sim.corrs(tree,matrix(c(1,-0.8,-0.8,1),2,2)))
Y[[1]]<-as.factor(threshState(Y[[1]],setNames(c(0,Inf),c("a","b"))))
Y[[2]]<-as.factor(threshState(Y[[2]],setNames(c(0,Inf),c("c","d"))))

Our data consists of a tree (tree) and two different data frames (X and Y). X contains a continuous and a binary character simulated with a positive correlation:

head(X,20)
##               V1 V2
## t42  -0.06287185  A
## t43   0.62161659  B
## t3    0.33923644  B
## t27   4.42227923  B
## t117  3.88113803  B
## t118  3.49517309  B
## t102  3.54326731  B
## t57   1.59927771  B
## t139  1.08430443  B
## t140  1.74020130  B
## t152  1.46544792  B
## t153  1.10855606  B
## t88   4.51812304  B
## t89   4.22916099  B
## t32   4.73396575  B
## t81   3.19849929  B
## t84   4.68859727  B
## t111  4.17455850  B
## t112  3.86534439  B
## t165  1.15840593  B

While Y contains two discrete traits simulated with a negative correlation:

head(Y,20)
##      V1 V2
## t42   a  d
## t43   a  d
## t3    a  d
## t27   a  d
## t117  a  d
## t118  a  d
## t102  a  d
## t57   a  d
## t139  a  d
## t140  a  d
## t152  a  d
## t153  b  c
## t88   b  d
## t89   a  d
## t32   a  d
## t81   a  d
## t84   a  d
## t111  a  d
## t112  a  d
## t165  a  d

OK, first I'll demo the graphical analysis of the MCMC. This makes the function run a bit slow, so I'll only do a limited number of generations (like 10,000) so you get the idea:

mcmc<-threshBayes(tree,X,types=c("cont","disc"),ngen=100000)
## Starting MCMC....
## genearation: 1000; mean acceptance rate: 0.13
## genearation: 2000; mean acceptance rate: 0.16
## genearation: 3000; mean acceptance rate: 0.27
## genearation: 4000; mean acceptance rate: 0.31
## genearation: 5000; mean acceptance rate: 0.32
## genearation: 6000; mean acceptance rate: 0.34
## genearation: 7000; mean acceptance rate: 0.32
## genearation: 8000; mean acceptance rate: 0.3
## genearation: 9000; mean acceptance rate: 0.29
## genearation: 10000; mean acceptance rate: 0.28
## genearation: 11000; mean acceptance rate: 0.15
## genearation: 12000; mean acceptance rate: 0.07
## genearation: 13000; mean acceptance rate: 0.05
## genearation: 14000; mean acceptance rate: 0.08
## genearation: 15000; mean acceptance rate: 0.11
## genearation: 16000; mean acceptance rate: 0.13
## genearation: 17000; mean acceptance rate: 0.14
## genearation: 18000; mean acceptance rate: 0.19
## genearation: 19000; mean acceptance rate: 0.25
## genearation: 20000; mean acceptance rate: 0.27
## genearation: 21000; mean acceptance rate: 0.54
## genearation: 22000; mean acceptance rate: 0.53
## genearation: 23000; mean acceptance rate: 0.45
## genearation: 24000; mean acceptance rate: 0.4
## genearation: 25000; mean acceptance rate: 0.35
## genearation: 26000; mean acceptance rate: 0.33
## genearation: 27000; mean acceptance rate: 0.32
## genearation: 28000; mean acceptance rate: 0.3
## genearation: 29000; mean acceptance rate: 0.29
## genearation: 30000; mean acceptance rate: 0.28
## genearation: 31000; mean acceptance rate: 0.05
## genearation: 32000; mean acceptance rate: 0.06
## genearation: 33000; mean acceptance rate: 0.1
## genearation: 34000; mean acceptance rate: 0.12
## genearation: 35000; mean acceptance rate: 0.15
## genearation: 36000; mean acceptance rate: 0.19
## genearation: 37000; mean acceptance rate: 0.22
## genearation: 38000; mean acceptance rate: 0.24
## genearation: 39000; mean acceptance rate: 0.22
## genearation: 40000; mean acceptance rate: 0.22
## genearation: 41000; mean acceptance rate: 0
## genearation: 42000; mean acceptance rate: 0.09
## genearation: 43000; mean acceptance rate: 0.19
## genearation: 44000; mean acceptance rate: 0.22
## genearation: 45000; mean acceptance rate: 0.18
## genearation: 46000; mean acceptance rate: 0.19
## genearation: 47000; mean acceptance rate: 0.23
## genearation: 48000; mean acceptance rate: 0.29
## genearation: 49000; mean acceptance rate: 0.3
## genearation: 50000; mean acceptance rate: 0.32
## genearation: 51000; mean acceptance rate: 0.5
## genearation: 52000; mean acceptance rate: 0.41
## genearation: 53000; mean acceptance rate: 0.36
## genearation: 54000; mean acceptance rate: 0.31
## genearation: 55000; mean acceptance rate: 0.27
## genearation: 56000; mean acceptance rate: 0.27
## genearation: 57000; mean acceptance rate: 0.25
## genearation: 58000; mean acceptance rate: 0.22
## genearation: 59000; mean acceptance rate: 0.19
## genearation: 60000; mean acceptance rate: 0.19
## genearation: 61000; mean acceptance rate: 0.22
## genearation: 62000; mean acceptance rate: 0.11
## genearation: 63000; mean acceptance rate: 0.15
## genearation: 64000; mean acceptance rate: 0.16
## genearation: 65000; mean acceptance rate: 0.22
## genearation: 66000; mean acceptance rate: 0.24
## genearation: 67000; mean acceptance rate: 0.31
## genearation: 68000; mean acceptance rate: 0.32
## genearation: 69000; mean acceptance rate: 0.32
## genearation: 70000; mean acceptance rate: 0.31
## genearation: 71000; mean acceptance rate: 0
## genearation: 72000; mean acceptance rate: 0.12
## genearation: 73000; mean acceptance rate: 0.2
## genearation: 74000; mean acceptance rate: 0.25
## genearation: 75000; mean acceptance rate: 0.26
## genearation: 76000; mean acceptance rate: 0.22
## genearation: 77000; mean acceptance rate: 0.28
## genearation: 78000; mean acceptance rate: 0.29
## genearation: 79000; mean acceptance rate: 0.29
## genearation: 80000; mean acceptance rate: 0.29
## genearation: 81000; mean acceptance rate: 0.4
## genearation: 82000; mean acceptance rate: 0.29
## genearation: 83000; mean acceptance rate: 0.22
## genearation: 84000; mean acceptance rate: 0.17
## genearation: 85000; mean acceptance rate: 0.19
## genearation: 86000; mean acceptance rate: 0.18
## genearation: 87000; mean acceptance rate: 0.17
## genearation: 88000; mean acceptance rate: 0.15
## genearation: 89000; mean acceptance rate: 0.13
## genearation: 90000; mean acceptance rate: 0.14
## genearation: 91000; mean acceptance rate: 0.18
## genearation: 92000; mean acceptance rate: 0.3
## genearation: 93000; mean acceptance rate: 0.39
## genearation: 94000; mean acceptance rate: 0.39
## genearation: 95000; mean acceptance rate: 0.32
## genearation: 96000; mean acceptance rate: 0.31
## genearation: 97000; mean acceptance rate: 0.28
## genearation: 98000; mean acceptance rate: 0.26
## genearation: 99000; mean acceptance rate: 0.24
## genearation: 100000; mean acceptance rate: 0.22
## Done MCMC.

Now let's plot the posterior distribution of the correlation coefficient, r:

plot(density(mcmc))

plot of chunk unnamed-chunk-8

Well, we simulated r = 0.7, so that's not bad.

Now let's try again, but with the two discrete characters.

mcmc<-threshBayes(tree,Y,types=c("disc","disc"),ngen=1000000,plot=FALSE)
## Starting MCMC....
## genearation: 1000; mean acceptance rate: 0.43
## genearation: 2000; mean acceptance rate: 0.39
## genearation: 3000; mean acceptance rate: 0.41
## genearation: 4000; mean acceptance rate: 0.39
## genearation: 5000; mean acceptance rate: 0.36
## genearation: 6000; mean acceptance rate: 0.3
## genearation: 7000; mean acceptance rate: 0.29
## genearation: 8000; mean acceptance rate: 0.25
## genearation: 9000; mean acceptance rate: 0.23
## genearation: 10000; mean acceptance rate: 0.26
## genearation: 11000; mean acceptance rate: 0.26
## genearation: 12000; mean acceptance rate: 0.32
## genearation: 13000; mean acceptance rate: 0.29
## genearation: 14000; mean acceptance rate: 0.22
## genearation: 15000; mean acceptance rate: 0.21
## genearation: 16000; mean acceptance rate: 0.21
## genearation: 17000; mean acceptance rate: 0.21
## genearation: 18000; mean acceptance rate: 0.19
## genearation: 19000; mean acceptance rate: 0.17
## genearation: 20000; mean acceptance rate: 0.15
## genearation: 21000; mean acceptance rate: 0.24
## genearation: 22000; mean acceptance rate: 0.11
## genearation: 23000; mean acceptance rate: 0.07
## genearation: 24000; mean acceptance rate: 0.09
## genearation: 25000; mean acceptance rate: 0.16
## genearation: 26000; mean acceptance rate: 0.22
## genearation: 27000; mean acceptance rate: 0.27
## genearation: 28000; mean acceptance rate: 0.25
## genearation: 29000; mean acceptance rate: 0.29
## genearation: 30000; mean acceptance rate: 0.33
## genearation: 31000; mean acceptance rate: 0.69
## genearation: 32000; mean acceptance rate: 0.48
## genearation: 33000; mean acceptance rate: 0.49
## genearation: 34000; mean acceptance rate: 0.49
## genearation: 35000; mean acceptance rate: 0.43
## genearation: 36000; mean acceptance rate: 0.4
## genearation: 37000; mean acceptance rate: 0.4
## genearation: 38000; mean acceptance rate: 0.38
## genearation: 39000; mean acceptance rate: 0.36
## genearation: 40000; mean acceptance rate: 0.34
## genearation: 41000; mean acceptance rate: 0.25
## genearation: 42000; mean acceptance rate: 0.23
## genearation: 43000; mean acceptance rate: 0.16
## genearation: 44000; mean acceptance rate: 0.13
## genearation: 45000; mean acceptance rate: 0.16
## genearation: 46000; mean acceptance rate: 0.13
## genearation: 47000; mean acceptance rate: 0.11
## genearation: 48000; mean acceptance rate: 0.1
## genearation: 49000; mean acceptance rate: 0.09
## genearation: 50000; mean acceptance rate: 0.09
## genearation: 51000; mean acceptance rate: 0.21
## genearation: 52000; mean acceptance rate: 0.24
## genearation: 53000; mean acceptance rate: 0.24
## genearation: 54000; mean acceptance rate: 0.18
## genearation: 55000; mean acceptance rate: 0.19
## genearation: 56000; mean acceptance rate: 0.16
## genearation: 57000; mean acceptance rate: 0.14
## genearation: 58000; mean acceptance rate: 0.12
## genearation: 59000; mean acceptance rate: 0.16
## genearation: 60000; mean acceptance rate: 0.16
## genearation: 61000; mean acceptance rate: 0.39
## genearation: 62000; mean acceptance rate: 0.43
## genearation: 63000; mean acceptance rate: 0.41
## genearation: 64000; mean acceptance rate: 0.35
## genearation: 65000; mean acceptance rate: 0.34
## genearation: 66000; mean acceptance rate: 0.32
## genearation: 67000; mean acceptance rate: 0.29
## genearation: 68000; mean acceptance rate: 0.27
## genearation: 69000; mean acceptance rate: 0.24
## genearation: 70000; mean acceptance rate: 0.22
## genearation: 71000; mean acceptance rate: 0.55
## genearation: 72000; mean acceptance rate: 0.36
## genearation: 73000; mean acceptance rate: 0.29
## genearation: 74000; mean acceptance rate: 0.22
## genearation: 75000; mean acceptance rate: 0.22
## genearation: 76000; mean acceptance rate: 0.22
## genearation: 77000; mean acceptance rate: 0.26
## genearation: 78000; mean acceptance rate: 0.26
## genearation: 79000; mean acceptance rate: 0.24
## genearation: 80000; mean acceptance rate: 0.22
## genearation: 81000; mean acceptance rate: 0
## genearation: 82000; mean acceptance rate: 0.06
## genearation: 83000; mean acceptance rate: 0.08
## genearation: 84000; mean acceptance rate: 0.13
## genearation: 85000; mean acceptance rate: 0.1
## genearation: 86000; mean acceptance rate: 0.08
## genearation: 87000; mean acceptance rate: 0.11
## genearation: 88000; mean acceptance rate: 0.09
## genearation: 89000; mean acceptance rate: 0.11
## genearation: 90000; mean acceptance rate: 0.16
## genearation: 91000; mean acceptance rate: 0
## genearation: 92000; mean acceptance rate: 0
## genearation: 93000; mean acceptance rate: 0.08
## genearation: 94000; mean acceptance rate: 0.19
## genearation: 95000; mean acceptance rate: 0.32
## genearation: 96000; mean acceptance rate: 0.4
## genearation: 97000; mean acceptance rate: 0.38
## genearation: 98000; mean acceptance rate: 0.41
## genearation: 99000; mean acceptance rate: 0.44
## genearation: 100000; mean acceptance rate: 0.47
## genearation: 101000; mean acceptance rate: 0.37
## genearation: 102000; mean acceptance rate: 0.37
## genearation: 103000; mean acceptance rate: 0.33
## genearation: 104000; mean acceptance rate: 0.27
## genearation: 105000; mean acceptance rate: 0.25
## genearation: 106000; mean acceptance rate: 0.32
## genearation: 107000; mean acceptance rate: 0.36
## genearation: 108000; mean acceptance rate: 0.33
## genearation: 109000; mean acceptance rate: 0.34
## genearation: 110000; mean acceptance rate: 0.34
## genearation: 111000; mean acceptance rate: 0.54
## genearation: 112000; mean acceptance rate: 0.4
## genearation: 113000; mean acceptance rate: 0.33
## genearation: 114000; mean acceptance rate: 0.3
## genearation: 115000; mean acceptance rate: 0.28
## genearation: 116000; mean acceptance rate: 0.27
## genearation: 117000; mean acceptance rate: 0.28
## genearation: 118000; mean acceptance rate: 0.27
## genearation: 119000; mean acceptance rate: 0.25
## genearation: 120000; mean acceptance rate: 0.24
## genearation: 121000; mean acceptance rate: 0.18
## genearation: 122000; mean acceptance rate: 0.28
## genearation: 123000; mean acceptance rate: 0.2
## genearation: 124000; mean acceptance rate: 0.15
## genearation: 125000; mean acceptance rate: 0.14
## genearation: 126000; mean acceptance rate: 0.16
## genearation: 127000; mean acceptance rate: 0.15
## genearation: 128000; mean acceptance rate: 0.19
## genearation: 129000; mean acceptance rate: 0.21
## genearation: 130000; mean acceptance rate: 0.22
## genearation: 131000; mean acceptance rate: 0.39
## genearation: 132000; mean acceptance rate: 0.52
## genearation: 133000; mean acceptance rate: 0.53
## genearation: 134000; mean acceptance rate: 0.53
## genearation: 135000; mean acceptance rate: 0.49
## genearation: 136000; mean acceptance rate: 0.42
## genearation: 137000; mean acceptance rate: 0.43
## genearation: 138000; mean acceptance rate: 0.41
## genearation: 139000; mean acceptance rate: 0.37
## genearation: 140000; mean acceptance rate: 0.33
## genearation: 141000; mean acceptance rate: 0.16
## genearation: 142000; mean acceptance rate: 0.23
## genearation: 143000; mean acceptance rate: 0.2
## genearation: 144000; mean acceptance rate: 0.23
## genearation: 145000; mean acceptance rate: 0.25
## genearation: 146000; mean acceptance rate: 0.25
## genearation: 147000; mean acceptance rate: 0.23
## genearation: 148000; mean acceptance rate: 0.23
## genearation: 149000; mean acceptance rate: 0.24
## genearation: 150000; mean acceptance rate: 0.24
## genearation: 151000; mean acceptance rate: 0.13
## genearation: 152000; mean acceptance rate: 0.12
## genearation: 153000; mean acceptance rate: 0.18
## genearation: 154000; mean acceptance rate: 0.15
## genearation: 155000; mean acceptance rate: 0.15
## genearation: 156000; mean acceptance rate: 0.18
## genearation: 157000; mean acceptance rate: 0.2
## genearation: 158000; mean acceptance rate: 0.19
## genearation: 159000; mean acceptance rate: 0.17
## genearation: 160000; mean acceptance rate: 0.18
## genearation: 161000; mean acceptance rate: 0
## genearation: 162000; mean acceptance rate: 0.17
## genearation: 163000; mean acceptance rate: 0.14
## genearation: 164000; mean acceptance rate: 0.14
## genearation: 165000; mean acceptance rate: 0.23
## genearation: 166000; mean acceptance rate: 0.19
## genearation: 167000; mean acceptance rate: 0.22
## genearation: 168000; mean acceptance rate: 0.21
## genearation: 169000; mean acceptance rate: 0.23
## genearation: 170000; mean acceptance rate: 0.27
## genearation: 171000; mean acceptance rate: 0.42
## genearation: 172000; mean acceptance rate: 0.44
## genearation: 173000; mean acceptance rate: 0.38
## genearation: 174000; mean acceptance rate: 0.37
## genearation: 175000; mean acceptance rate: 0.32
## genearation: 176000; mean acceptance rate: 0.33
## genearation: 177000; mean acceptance rate: 0.3
## genearation: 178000; mean acceptance rate: 0.3
## genearation: 179000; mean acceptance rate: 0.3
## genearation: 180000; mean acceptance rate: 0.27
## genearation: 181000; mean acceptance rate: 0.19
## genearation: 182000; mean acceptance rate: 0.09
## genearation: 183000; mean acceptance rate: 0.11
## genearation: 184000; mean acceptance rate: 0.08
## genearation: 185000; mean acceptance rate: 0.11
## genearation: 186000; mean acceptance rate: 0.14
## genearation: 187000; mean acceptance rate: 0.12
## genearation: 188000; mean acceptance rate: 0.14
## genearation: 189000; mean acceptance rate: 0.15
## genearation: 190000; mean acceptance rate: 0.18
## genearation: 191000; mean acceptance rate: 0.37
## genearation: 192000; mean acceptance rate: 0.35
## genearation: 193000; mean acceptance rate: 0.4
## genearation: 194000; mean acceptance rate: 0.37
## genearation: 195000; mean acceptance rate: 0.34
## genearation: 196000; mean acceptance rate: 0.36
## genearation: 197000; mean acceptance rate: 0.33
## genearation: 198000; mean acceptance rate: 0.29
## genearation: 199000; mean acceptance rate: 0.3
## genearation: 200000; mean acceptance rate: 0.29
## genearation: 201000; mean acceptance rate: 0.17
## genearation: 202000; mean acceptance rate: 0.2
## genearation: 203000; mean acceptance rate: 0.14
## genearation: 204000; mean acceptance rate: 0.22
## genearation: 205000; mean acceptance rate: 0.21
## genearation: 206000; mean acceptance rate: 0.18
## genearation: 207000; mean acceptance rate: 0.15
## genearation: 208000; mean acceptance rate: 0.16
## genearation: 209000; mean acceptance rate: 0.19
## genearation: 210000; mean acceptance rate: 0.18
## genearation: 211000; mean acceptance rate: 0.61
## genearation: 212000; mean acceptance rate: 0.5
## genearation: 213000; mean acceptance rate: 0.51
## genearation: 214000; mean acceptance rate: 0.51
## genearation: 215000; mean acceptance rate: 0.47
## genearation: 216000; mean acceptance rate: 0.43
## genearation: 217000; mean acceptance rate: 0.4
## genearation: 218000; mean acceptance rate: 0.38
## genearation: 219000; mean acceptance rate: 0.39
## genearation: 220000; mean acceptance rate: 0.38
## genearation: 221000; mean acceptance rate: 0.24
## genearation: 222000; mean acceptance rate: 0.26
## genearation: 223000; mean acceptance rate: 0.29
## genearation: 224000; mean acceptance rate: 0.26
## genearation: 225000; mean acceptance rate: 0.26
## genearation: 226000; mean acceptance rate: 0.26
## genearation: 227000; mean acceptance rate: 0.26
## genearation: 228000; mean acceptance rate: 0.26
## genearation: 229000; mean acceptance rate: 0.25
## genearation: 230000; mean acceptance rate: 0.24
## genearation: 231000; mean acceptance rate: 0.04
## genearation: 232000; mean acceptance rate: 0.14
## genearation: 233000; mean acceptance rate: 0.12
## genearation: 234000; mean acceptance rate: 0.18
## genearation: 235000; mean acceptance rate: 0.14
## genearation: 236000; mean acceptance rate: 0.17
## genearation: 237000; mean acceptance rate: 0.21
## genearation: 238000; mean acceptance rate: 0.21
## genearation: 239000; mean acceptance rate: 0.19
## genearation: 240000; mean acceptance rate: 0.17
## genearation: 241000; mean acceptance rate: 0.21
## genearation: 242000; mean acceptance rate: 0.17
## genearation: 243000; mean acceptance rate: 0.11
## genearation: 244000; mean acceptance rate: 0.11
## genearation: 245000; mean acceptance rate: 0.16
## genearation: 246000; mean acceptance rate: 0.14
## genearation: 247000; mean acceptance rate: 0.16
## genearation: 248000; mean acceptance rate: 0.2
## genearation: 249000; mean acceptance rate: 0.21
## genearation: 250000; mean acceptance rate: 0.19
## genearation: 251000; mean acceptance rate: 0
## genearation: 252000; mean acceptance rate: 0
## genearation: 253000; mean acceptance rate: 0.08
## genearation: 254000; mean acceptance rate: 0.1
## genearation: 255000; mean acceptance rate: 0.24
## genearation: 256000; mean acceptance rate: 0.26
## genearation: 257000; mean acceptance rate: 0.3
## genearation: 258000; mean acceptance rate: 0.35
## genearation: 259000; mean acceptance rate: 0.37
## genearation: 260000; mean acceptance rate: 0.37
## genearation: 261000; mean acceptance rate: 0.29
## genearation: 262000; mean acceptance rate: 0.43
## genearation: 263000; mean acceptance rate: 0.46
## genearation: 264000; mean acceptance rate: 0.41
## genearation: 265000; mean acceptance rate: 0.41
## genearation: 266000; mean acceptance rate: 0.36
## genearation: 267000; mean acceptance rate: 0.31
## genearation: 268000; mean acceptance rate: 0.27
## genearation: 269000; mean acceptance rate: 0.26
## genearation: 270000; mean acceptance rate: 0.24
## genearation: 271000; mean acceptance rate: 0.21
## genearation: 272000; mean acceptance rate: 0.2
## genearation: 273000; mean acceptance rate: 0.23
## genearation: 274000; mean acceptance rate: 0.29
## genearation: 275000; mean acceptance rate: 0.26
## genearation: 276000; mean acceptance rate: 0.27
## genearation: 277000; mean acceptance rate: 0.29
## genearation: 278000; mean acceptance rate: 0.28
## genearation: 279000; mean acceptance rate: 0.29
## genearation: 280000; mean acceptance rate: 0.26
## genearation: 281000; mean acceptance rate: 0.26
## genearation: 282000; mean acceptance rate: 0.26
## genearation: 283000; mean acceptance rate: 0.23
## genearation: 284000; mean acceptance rate: 0.22
## genearation: 285000; mean acceptance rate: 0.23
## genearation: 286000; mean acceptance rate: 0.23
## genearation: 287000; mean acceptance rate: 0.21
## genearation: 288000; mean acceptance rate: 0.2
## genearation: 289000; mean acceptance rate: 0.18
## genearation: 290000; mean acceptance rate: 0.16
## genearation: 291000; mean acceptance rate: 0.02
## genearation: 292000; mean acceptance rate: 0.24
## genearation: 293000; mean acceptance rate: 0.2
## genearation: 294000; mean acceptance rate: 0.27
## genearation: 295000; mean acceptance rate: 0.28
## genearation: 296000; mean acceptance rate: 0.28
## genearation: 297000; mean acceptance rate: 0.25
## genearation: 298000; mean acceptance rate: 0.25
## genearation: 299000; mean acceptance rate: 0.25
## genearation: 300000; mean acceptance rate: 0.24
## genearation: 301000; mean acceptance rate: 0
## genearation: 302000; mean acceptance rate: 0.23
## genearation: 303000; mean acceptance rate: 0.2
## genearation: 304000; mean acceptance rate: 0.15
## genearation: 305000; mean acceptance rate: 0.16
## genearation: 306000; mean acceptance rate: 0.24
## genearation: 307000; mean acceptance rate: 0.25
## genearation: 308000; mean acceptance rate: 0.28
## genearation: 309000; mean acceptance rate: 0.29
## genearation: 310000; mean acceptance rate: 0.31
## genearation: 311000; mean acceptance rate: 0.39
## genearation: 312000; mean acceptance rate: 0.45
## genearation: 313000; mean acceptance rate: 0.38
## genearation: 314000; mean acceptance rate: 0.29
## genearation: 315000; mean acceptance rate: 0.29
## genearation: 316000; mean acceptance rate: 0.25
## genearation: 317000; mean acceptance rate: 0.21
## genearation: 318000; mean acceptance rate: 0.21
## genearation: 319000; mean acceptance rate: 0.18
## genearation: 320000; mean acceptance rate: 0.19
## genearation: 321000; mean acceptance rate: 0.09
## genearation: 322000; mean acceptance rate: 0.1
## genearation: 323000; mean acceptance rate: 0.14
## genearation: 324000; mean acceptance rate: 0.1
## genearation: 325000; mean acceptance rate: 0.15
## genearation: 326000; mean acceptance rate: 0.15
## genearation: 327000; mean acceptance rate: 0.13
## genearation: 328000; mean acceptance rate: 0.18
## genearation: 329000; mean acceptance rate: 0.16
## genearation: 330000; mean acceptance rate: 0.17
## genearation: 331000; mean acceptance rate: 0.39
## genearation: 332000; mean acceptance rate: 0.41
## genearation: 333000; mean acceptance rate: 0.41
## genearation: 334000; mean acceptance rate: 0.36
## genearation: 335000; mean acceptance rate: 0.29
## genearation: 336000; mean acceptance rate: 0.28
## genearation: 337000; mean acceptance rate: 0.24
## genearation: 338000; mean acceptance rate: 0.27
## genearation: 339000; mean acceptance rate: 0.28
## genearation: 340000; mean acceptance rate: 0.3
## genearation: 341000; mean acceptance rate: 0
## genearation: 342000; mean acceptance rate: 0
## genearation: 343000; mean acceptance rate: 0.09
## genearation: 344000; mean acceptance rate: 0.13
## genearation: 345000; mean acceptance rate: 0.23
## genearation: 346000; mean acceptance rate: 0.32
## genearation: 347000; mean acceptance rate: 0.37
## genearation: 348000; mean acceptance rate: 0.35
## genearation: 349000; mean acceptance rate: 0.34
## genearation: 350000; mean acceptance rate: 0.35
## genearation: 351000; mean acceptance rate: 0.35
## genearation: 352000; mean acceptance rate: 0.23
## genearation: 353000; mean acceptance rate: 0.25
## genearation: 354000; mean acceptance rate: 0.27
## genearation: 355000; mean acceptance rate: 0.24
## genearation: 356000; mean acceptance rate: 0.27
## genearation: 357000; mean acceptance rate: 0.25
## genearation: 358000; mean acceptance rate: 0.26
## genearation: 359000; mean acceptance rate: 0.3
## genearation: 360000; mean acceptance rate: 0.32
## genearation: 361000; mean acceptance rate: 0
## genearation: 362000; mean acceptance rate: 0.12
## genearation: 363000; mean acceptance rate: 0.08
## genearation: 364000; mean acceptance rate: 0.06
## genearation: 365000; mean acceptance rate: 0.05
## genearation: 366000; mean acceptance rate: 0.09
## genearation: 367000; mean acceptance rate: 0.12
## genearation: 368000; mean acceptance rate: 0.18
## genearation: 369000; mean acceptance rate: 0.21
## genearation: 370000; mean acceptance rate: 0.26
## genearation: 371000; mean acceptance rate: 0.62
## genearation: 372000; mean acceptance rate: 0.66
## genearation: 373000; mean acceptance rate: 0.45
## genearation: 374000; mean acceptance rate: 0.48
## genearation: 375000; mean acceptance rate: 0.52
## genearation: 376000; mean acceptance rate: 0.54
## genearation: 377000; mean acceptance rate: 0.51
## genearation: 378000; mean acceptance rate: 0.51
## genearation: 379000; mean acceptance rate: 0.48
## genearation: 380000; mean acceptance rate: 0.45
## genearation: 381000; mean acceptance rate: 0.07
## genearation: 382000; mean acceptance rate: 0.1
## genearation: 383000; mean acceptance rate: 0.25
## genearation: 384000; mean acceptance rate: 0.27
## genearation: 385000; mean acceptance rate: 0.25
## genearation: 386000; mean acceptance rate: 0.22
## genearation: 387000; mean acceptance rate: 0.23
## genearation: 388000; mean acceptance rate: 0.24
## genearation: 389000; mean acceptance rate: 0.22
## genearation: 390000; mean acceptance rate: 0.23
## genearation: 391000; mean acceptance rate: 0.46
## genearation: 392000; mean acceptance rate: 0.22
## genearation: 393000; mean acceptance rate: 0.15
## genearation: 394000; mean acceptance rate: 0.15
## genearation: 395000; mean acceptance rate: 0.13
## genearation: 396000; mean acceptance rate: 0.14
## genearation: 397000; mean acceptance rate: 0.19
## genearation: 398000; mean acceptance rate: 0.23
## genearation: 399000; mean acceptance rate: 0.22
## genearation: 400000; mean acceptance rate: 0.2
## genearation: 401000; mean acceptance rate: 0
## genearation: 402000; mean acceptance rate: 0
## genearation: 403000; mean acceptance rate: 0.09
## genearation: 404000; mean acceptance rate: 0.07
## genearation: 405000; mean acceptance rate: 0.11
## genearation: 406000; mean acceptance rate: 0.12
## genearation: 407000; mean acceptance rate: 0.17
## genearation: 408000; mean acceptance rate: 0.19
## genearation: 409000; mean acceptance rate: 0.19
## genearation: 410000; mean acceptance rate: 0.2
## genearation: 411000; mean acceptance rate: 0.38
## genearation: 412000; mean acceptance rate: 0.39
## genearation: 413000; mean acceptance rate: 0.35
## genearation: 414000; mean acceptance rate: 0.38
## genearation: 415000; mean acceptance rate: 0.45
## genearation: 416000; mean acceptance rate: 0.43
## genearation: 417000; mean acceptance rate: 0.44
## genearation: 418000; mean acceptance rate: 0.43
## genearation: 419000; mean acceptance rate: 0.41
## genearation: 420000; mean acceptance rate: 0.38
## genearation: 421000; mean acceptance rate: 0.45
## genearation: 422000; mean acceptance rate: 0.34
## genearation: 423000; mean acceptance rate: 0.23
## genearation: 424000; mean acceptance rate: 0.23
## genearation: 425000; mean acceptance rate: 0.24
## genearation: 426000; mean acceptance rate: 0.21
## genearation: 427000; mean acceptance rate: 0.2
## genearation: 428000; mean acceptance rate: 0.19
## genearation: 429000; mean acceptance rate: 0.2
## genearation: 430000; mean acceptance rate: 0.19
## genearation: 431000; mean acceptance rate: 0.27
## genearation: 432000; mean acceptance rate: 0.13
## genearation: 433000; mean acceptance rate: 0.25
## genearation: 434000; mean acceptance rate: 0.25
## genearation: 435000; mean acceptance rate: 0.27
## genearation: 436000; mean acceptance rate: 0.29
## genearation: 437000; mean acceptance rate: 0.34
## genearation: 438000; mean acceptance rate: 0.34
## genearation: 439000; mean acceptance rate: 0.31
## genearation: 440000; mean acceptance rate: 0.34
## genearation: 441000; mean acceptance rate: 0.39
## genearation: 442000; mean acceptance rate: 0.49
## genearation: 443000; mean acceptance rate: 0.34
## genearation: 444000; mean acceptance rate: 0.36
## genearation: 445000; mean acceptance rate: 0.34
## genearation: 446000; mean acceptance rate: 0.35
## genearation: 447000; mean acceptance rate: 0.36
## genearation: 448000; mean acceptance rate: 0.31
## genearation: 449000; mean acceptance rate: 0.32
## genearation: 450000; mean acceptance rate: 0.31
## genearation: 451000; mean acceptance rate: 0.03
## genearation: 452000; mean acceptance rate: 0.11
## genearation: 453000; mean acceptance rate: 0.08
## genearation: 454000; mean acceptance rate: 0.18
## genearation: 455000; mean acceptance rate: 0.16
## genearation: 456000; mean acceptance rate: 0.13
## genearation: 457000; mean acceptance rate: 0.15
## genearation: 458000; mean acceptance rate: 0.19
## genearation: 459000; mean acceptance rate: 0.19
## genearation: 460000; mean acceptance rate: 0.17
## genearation: 461000; mean acceptance rate: 0.24
## genearation: 462000; mean acceptance rate: 0.24
## genearation: 463000; mean acceptance rate: 0.23
## genearation: 464000; mean acceptance rate: 0.25
## genearation: 465000; mean acceptance rate: 0.24
## genearation: 466000; mean acceptance rate: 0.29
## genearation: 467000; mean acceptance rate: 0.32
## genearation: 468000; mean acceptance rate: 0.29
## genearation: 469000; mean acceptance rate: 0.25
## genearation: 470000; mean acceptance rate: 0.23
## genearation: 471000; mean acceptance rate: 0
## genearation: 472000; mean acceptance rate: 0
## genearation: 473000; mean acceptance rate: 0
## genearation: 474000; mean acceptance rate: 0.07
## genearation: 475000; mean acceptance rate: 0.1
## genearation: 476000; mean acceptance rate: 0.12
## genearation: 477000; mean acceptance rate: 0.11
## genearation: 478000; mean acceptance rate: 0.13
## genearation: 479000; mean acceptance rate: 0.15
## genearation: 480000; mean acceptance rate: 0.17
## genearation: 481000; mean acceptance rate: 0.44
## genearation: 482000; mean acceptance rate: 0.61
## genearation: 483000; mean acceptance rate: 0.64
## genearation: 484000; mean acceptance rate: 0.59
## genearation: 485000; mean acceptance rate: 0.55
## genearation: 486000; mean acceptance rate: 0.52
## genearation: 487000; mean acceptance rate: 0.46
## genearation: 488000; mean acceptance rate: 0.45
## genearation: 489000; mean acceptance rate: 0.44
## genearation: 490000; mean acceptance rate: 0.42
## genearation: 491000; mean acceptance rate: 0.19
## genearation: 492000; mean acceptance rate: 0.09
## genearation: 493000; mean acceptance rate: 0.13
## genearation: 494000; mean acceptance rate: 0.14
## genearation: 495000; mean acceptance rate: 0.12
## genearation: 496000; mean acceptance rate: 0.13
## genearation: 497000; mean acceptance rate: 0.11
## genearation: 498000; mean acceptance rate: 0.12
## genearation: 499000; mean acceptance rate: 0.12
## genearation: 500000; mean acceptance rate: 0.12
## genearation: 501000; mean acceptance rate: 0.36
## genearation: 502000; mean acceptance rate: 0.18
## genearation: 503000; mean acceptance rate: 0.21
## genearation: 504000; mean acceptance rate: 0.16
## genearation: 505000; mean acceptance rate: 0.18
## genearation: 506000; mean acceptance rate: 0.18
## genearation: 507000; mean acceptance rate: 0.17
## genearation: 508000; mean acceptance rate: 0.17
## genearation: 509000; mean acceptance rate: 0.21
## genearation: 510000; mean acceptance rate: 0.25
## genearation: 511000; mean acceptance rate: 0.59
## genearation: 512000; mean acceptance rate: 0.68
## genearation: 513000; mean acceptance rate: 0.61
## genearation: 514000; mean acceptance rate: 0.61
## genearation: 515000; mean acceptance rate: 0.6
## genearation: 516000; mean acceptance rate: 0.55
## genearation: 517000; mean acceptance rate: 0.57
## genearation: 518000; mean acceptance rate: 0.51
## genearation: 519000; mean acceptance rate: 0.49
## genearation: 520000; mean acceptance rate: 0.49
## genearation: 521000; mean acceptance rate: 0.15
## genearation: 522000; mean acceptance rate: 0.19
## genearation: 523000; mean acceptance rate: 0.26
## genearation: 524000; mean acceptance rate: 0.21
## genearation: 525000; mean acceptance rate: 0.16
## genearation: 526000; mean acceptance rate: 0.17
## genearation: 527000; mean acceptance rate: 0.23
## genearation: 528000; mean acceptance rate: 0.24
## genearation: 529000; mean acceptance rate: 0.21
## genearation: 530000; mean acceptance rate: 0.22
## genearation: 531000; mean acceptance rate: 0.33
## genearation: 532000; mean acceptance rate: 0.48
## genearation: 533000; mean acceptance rate: 0.46
## genearation: 534000; mean acceptance rate: 0.4
## genearation: 535000; mean acceptance rate: 0.4
## genearation: 536000; mean acceptance rate: 0.33
## genearation: 537000; mean acceptance rate: 0.31
## genearation: 538000; mean acceptance rate: 0.32
## genearation: 539000; mean acceptance rate: 0.33
## genearation: 540000; mean acceptance rate: 0.3
## genearation: 541000; mean acceptance rate: 0.24
## genearation: 542000; mean acceptance rate: 0.28
## genearation: 543000; mean acceptance rate: 0.31
## genearation: 544000; mean acceptance rate: 0.3
## genearation: 545000; mean acceptance rate: 0.24
## genearation: 546000; mean acceptance rate: 0.22
## genearation: 547000; mean acceptance rate: 0.19
## genearation: 548000; mean acceptance rate: 0.17
## genearation: 549000; mean acceptance rate: 0.15
## genearation: 550000; mean acceptance rate: 0.13
## genearation: 551000; mean acceptance rate: 0
## genearation: 552000; mean acceptance rate: 0
## genearation: 553000; mean acceptance rate: 0
## genearation: 554000; mean acceptance rate: 0
## genearation: 555000; mean acceptance rate: 0
## genearation: 556000; mean acceptance rate: 0
## genearation: 557000; mean acceptance rate: 0.04
## genearation: 558000; mean acceptance rate: 0.12
## genearation: 559000; mean acceptance rate: 0.18
## genearation: 560000; mean acceptance rate: 0.19
## genearation: 561000; mean acceptance rate: 0.13
## genearation: 562000; mean acceptance rate: 0.32
## genearation: 563000; mean acceptance rate: 0.23
## genearation: 564000; mean acceptance rate: 0.26
## genearation: 565000; mean acceptance rate: 0.3
## genearation: 566000; mean acceptance rate: 0.29
## genearation: 567000; mean acceptance rate: 0.32
## genearation: 568000; mean acceptance rate: 0.34
## genearation: 569000; mean acceptance rate: 0.33
## genearation: 570000; mean acceptance rate: 0.31
## genearation: 571000; mean acceptance rate: 0.54
## genearation: 572000; mean acceptance rate: 0.32
## genearation: 573000; mean acceptance rate: 0.33
## genearation: 574000; mean acceptance rate: 0.32
## genearation: 575000; mean acceptance rate: 0.29
## genearation: 576000; mean acceptance rate: 0.28
## genearation: 577000; mean acceptance rate: 0.26
## genearation: 578000; mean acceptance rate: 0.26
## genearation: 579000; mean acceptance rate: 0.25
## genearation: 580000; mean acceptance rate: 0.23
## genearation: 581000; mean acceptance rate: 0.45
## genearation: 582000; mean acceptance rate: 0.26
## genearation: 583000; mean acceptance rate: 0.22
## genearation: 584000; mean acceptance rate: 0.31
## genearation: 585000; mean acceptance rate: 0.35
## genearation: 586000; mean acceptance rate: 0.34
## genearation: 587000; mean acceptance rate: 0.35
## genearation: 588000; mean acceptance rate: 0.34
## genearation: 589000; mean acceptance rate: 0.34
## genearation: 590000; mean acceptance rate: 0.35
## genearation: 591000; mean acceptance rate: 0.25
## genearation: 592000; mean acceptance rate: 0.23
## genearation: 593000; mean acceptance rate: 0.26
## genearation: 594000; mean acceptance rate: 0.23
## genearation: 595000; mean acceptance rate: 0.23
## genearation: 596000; mean acceptance rate: 0.23
## genearation: 597000; mean acceptance rate: 0.21
## genearation: 598000; mean acceptance rate: 0.22
## genearation: 599000; mean acceptance rate: 0.19
## genearation: 600000; mean acceptance rate: 0.17
## genearation: 601000; mean acceptance rate: 0
## genearation: 602000; mean acceptance rate: 0.03
## genearation: 603000; mean acceptance rate: 0.19
## genearation: 604000; mean acceptance rate: 0.24
## genearation: 605000; mean acceptance rate: 0.24
## genearation: 606000; mean acceptance rate: 0.23
## genearation: 607000; mean acceptance rate: 0.22
## genearation: 608000; mean acceptance rate: 0.2
## genearation: 609000; mean acceptance rate: 0.2
## genearation: 610000; mean acceptance rate: 0.2
## genearation: 611000; mean acceptance rate: 0
## genearation: 612000; mean acceptance rate: 0
## genearation: 613000; mean acceptance rate: 0.07
## genearation: 614000; mean acceptance rate: 0.22
## genearation: 615000; mean acceptance rate: 0.25
## genearation: 616000; mean acceptance rate: 0.28
## genearation: 617000; mean acceptance rate: 0.26
## genearation: 618000; mean acceptance rate: 0.27
## genearation: 619000; mean acceptance rate: 0.26
## genearation: 620000; mean acceptance rate: 0.28
## genearation: 621000; mean acceptance rate: 0.18
## genearation: 622000; mean acceptance rate: 0.23
## genearation: 623000; mean acceptance rate: 0.15
## genearation: 624000; mean acceptance rate: 0.17
## genearation: 625000; mean acceptance rate: 0.19
## genearation: 626000; mean acceptance rate: 0.21
## genearation: 627000; mean acceptance rate: 0.21
## genearation: 628000; mean acceptance rate: 0.19
## genearation: 629000; mean acceptance rate: 0.17
## genearation: 630000; mean acceptance rate: 0.19
## genearation: 631000; mean acceptance rate: 0.2
## genearation: 632000; mean acceptance rate: 0.43
## genearation: 633000; mean acceptance rate: 0.5
## genearation: 634000; mean acceptance rate: 0.48
## genearation: 635000; mean acceptance rate: 0.53
## genearation: 636000; mean acceptance rate: 0.55
## genearation: 637000; mean acceptance rate: 0.52
## genearation: 638000; mean acceptance rate: 0.47
## genearation: 639000; mean acceptance rate: 0.44
## genearation: 640000; mean acceptance rate: 0.42
## genearation: 641000; mean acceptance rate: 0.33
## genearation: 642000; mean acceptance rate: 0.21
## genearation: 643000; mean acceptance rate: 0.24
## genearation: 644000; mean acceptance rate: 0.2
## genearation: 645000; mean acceptance rate: 0.24
## genearation: 646000; mean acceptance rate: 0.25
## genearation: 647000; mean acceptance rate: 0.29
## genearation: 648000; mean acceptance rate: 0.29
## genearation: 649000; mean acceptance rate: 0.28
## genearation: 650000; mean acceptance rate: 0.28
## genearation: 651000; mean acceptance rate: 0.43
## genearation: 652000; mean acceptance rate: 0.34
## genearation: 653000; mean acceptance rate: 0.28
## genearation: 654000; mean acceptance rate: 0.27
## genearation: 655000; mean acceptance rate: 0.3
## genearation: 656000; mean acceptance rate: 0.27
## genearation: 657000; mean acceptance rate: 0.24
## genearation: 658000; mean acceptance rate: 0.21
## genearation: 659000; mean acceptance rate: 0.19
## genearation: 660000; mean acceptance rate: 0.19
## genearation: 661000; mean acceptance rate: 0.05
## genearation: 662000; mean acceptance rate: 0.03
## genearation: 663000; mean acceptance rate: 0.1
## genearation: 664000; mean acceptance rate: 0.18
## genearation: 665000; mean acceptance rate: 0.19
## genearation: 666000; mean acceptance rate: 0.18
## genearation: 667000; mean acceptance rate: 0.24
## genearation: 668000; mean acceptance rate: 0.23
## genearation: 669000; mean acceptance rate: 0.26
## genearation: 670000; mean acceptance rate: 0.25
## genearation: 671000; mean acceptance rate: 0.56
## genearation: 672000; mean acceptance rate: 0.27
## genearation: 673000; mean acceptance rate: 0.24
## genearation: 674000; mean acceptance rate: 0.18
## genearation: 675000; mean acceptance rate: 0.18
## genearation: 676000; mean acceptance rate: 0.15
## genearation: 677000; mean acceptance rate: 0.16
## genearation: 678000; mean acceptance rate: 0.21
## genearation: 679000; mean acceptance rate: 0.23
## genearation: 680000; mean acceptance rate: 0.21
## genearation: 681000; mean acceptance rate: 0.47
## genearation: 682000; mean acceptance rate: 0.37
## genearation: 683000; mean acceptance rate: 0.39
## genearation: 684000; mean acceptance rate: 0.32
## genearation: 685000; mean acceptance rate: 0.34
## genearation: 686000; mean acceptance rate: 0.31
## genearation: 687000; mean acceptance rate: 0.27
## genearation: 688000; mean acceptance rate: 0.24
## genearation: 689000; mean acceptance rate: 0.21
## genearation: 690000; mean acceptance rate: 0.21
## genearation: 691000; mean acceptance rate: 0
## genearation: 692000; mean acceptance rate: 0.01
## genearation: 693000; mean acceptance rate: 0.07
## genearation: 694000; mean acceptance rate: 0.06
## genearation: 695000; mean acceptance rate: 0.1
## genearation: 696000; mean acceptance rate: 0.13
## genearation: 697000; mean acceptance rate: 0.19
## genearation: 698000; mean acceptance rate: 0.19
## genearation: 699000; mean acceptance rate: 0.17
## genearation: 700000; mean acceptance rate: 0.18
## genearation: 701000; mean acceptance rate: 0.39
## genearation: 702000; mean acceptance rate: 0.43
## genearation: 703000; mean acceptance rate: 0.51
## genearation: 704000; mean acceptance rate: 0.53
## genearation: 705000; mean acceptance rate: 0.48
## genearation: 706000; mean acceptance rate: 0.43
## genearation: 707000; mean acceptance rate: 0.42
## genearation: 708000; mean acceptance rate: 0.43
## genearation: 709000; mean acceptance rate: 0.42
## genearation: 710000; mean acceptance rate: 0.39
## genearation: 711000; mean acceptance rate: 0.15
## genearation: 712000; mean acceptance rate: 0.07
## genearation: 713000; mean acceptance rate: 0.12
## genearation: 714000; mean acceptance rate: 0.09
## genearation: 715000; mean acceptance rate: 0.07
## genearation: 716000; mean acceptance rate: 0.11
## genearation: 717000; mean acceptance rate: 0.12
## genearation: 718000; mean acceptance rate: 0.18
## genearation: 719000; mean acceptance rate: 0.19
## genearation: 720000; mean acceptance rate: 0.19
## genearation: 721000; mean acceptance rate: 0.3
## genearation: 722000; mean acceptance rate: 0.28
## genearation: 723000; mean acceptance rate: 0.28
## genearation: 724000; mean acceptance rate: 0.37
## genearation: 725000; mean acceptance rate: 0.32
## genearation: 726000; mean acceptance rate: 0.32
## genearation: 727000; mean acceptance rate: 0.28
## genearation: 728000; mean acceptance rate: 0.27
## genearation: 729000; mean acceptance rate: 0.29
## genearation: 730000; mean acceptance rate: 0.29
## genearation: 731000; mean acceptance rate: 0.32
## genearation: 732000; mean acceptance rate: 0.16
## genearation: 733000; mean acceptance rate: 0.1
## genearation: 734000; mean acceptance rate: 0.08
## genearation: 735000; mean acceptance rate: 0.1
## genearation: 736000; mean acceptance rate: 0.2
## genearation: 737000; mean acceptance rate: 0.19
## genearation: 738000; mean acceptance rate: 0.23
## genearation: 739000; mean acceptance rate: 0.26
## genearation: 740000; mean acceptance rate: 0.25
## genearation: 741000; mean acceptance rate: 0.19
## genearation: 742000; mean acceptance rate: 0.37
## genearation: 743000; mean acceptance rate: 0.39
## genearation: 744000; mean acceptance rate: 0.34
## genearation: 745000; mean acceptance rate: 0.3
## genearation: 746000; mean acceptance rate: 0.34
## genearation: 747000; mean acceptance rate: 0.3
## genearation: 748000; mean acceptance rate: 0.26
## genearation: 749000; mean acceptance rate: 0.26
## genearation: 750000; mean acceptance rate: 0.24
## genearation: 751000; mean acceptance rate: 0.11
## genearation: 752000; mean acceptance rate: 0.2
## genearation: 753000; mean acceptance rate: 0.13
## genearation: 754000; mean acceptance rate: 0.16
## genearation: 755000; mean acceptance rate: 0.13
## genearation: 756000; mean acceptance rate: 0.14
## genearation: 757000; mean acceptance rate: 0.15
## genearation: 758000; mean acceptance rate: 0.19
## genearation: 759000; mean acceptance rate: 0.22
## genearation: 760000; mean acceptance rate: 0.22
## genearation: 761000; mean acceptance rate: 0.49
## genearation: 762000; mean acceptance rate: 0.37
## genearation: 763000; mean acceptance rate: 0.32
## genearation: 764000; mean acceptance rate: 0.28
## genearation: 765000; mean acceptance rate: 0.25
## genearation: 766000; mean acceptance rate: 0.23
## genearation: 767000; mean acceptance rate: 0.24
## genearation: 768000; mean acceptance rate: 0.23
## genearation: 769000; mean acceptance rate: 0.23
## genearation: 770000; mean acceptance rate: 0.21
## genearation: 771000; mean acceptance rate: 0.25
## genearation: 772000; mean acceptance rate: 0.21
## genearation: 773000; mean acceptance rate: 0.25
## genearation: 774000; mean acceptance rate: 0.28
## genearation: 775000; mean acceptance rate: 0.28
## genearation: 776000; mean acceptance rate: 0.27
## genearation: 777000; mean acceptance rate: 0.3
## genearation: 778000; mean acceptance rate: 0.3
## genearation: 779000; mean acceptance rate: 0.3
## genearation: 780000; mean acceptance rate: 0.28
## genearation: 781000; mean acceptance rate: 0.09
## genearation: 782000; mean acceptance rate: 0.15
## genearation: 783000; mean acceptance rate: 0.1
## genearation: 784000; mean acceptance rate: 0.08
## genearation: 785000; mean acceptance rate: 0.06
## genearation: 786000; mean acceptance rate: 0.05
## genearation: 787000; mean acceptance rate: 0.1
## genearation: 788000; mean acceptance rate: 0.1
## genearation: 789000; mean acceptance rate: 0.17
## genearation: 790000; mean acceptance rate: 0.19
## genearation: 791000; mean acceptance rate: 0.24
## genearation: 792000; mean acceptance rate: 0.34
## genearation: 793000; mean acceptance rate: 0.4
## genearation: 794000; mean acceptance rate: 0.41
## genearation: 795000; mean acceptance rate: 0.41
## genearation: 796000; mean acceptance rate: 0.35
## genearation: 797000; mean acceptance rate: 0.3
## genearation: 798000; mean acceptance rate: 0.3
## genearation: 799000; mean acceptance rate: 0.31
## genearation: 800000; mean acceptance rate: 0.31
## genearation: 801000; mean acceptance rate: 0.56
## genearation: 802000; mean acceptance rate: 0.33
## genearation: 803000; mean acceptance rate: 0.24
## genearation: 804000; mean acceptance rate: 0.18
## genearation: 805000; mean acceptance rate: 0.21
## genearation: 806000; mean acceptance rate: 0.19
## genearation: 807000; mean acceptance rate: 0.19
## genearation: 808000; mean acceptance rate: 0.16
## genearation: 809000; mean acceptance rate: 0.18
## genearation: 810000; mean acceptance rate: 0.2
## genearation: 811000; mean acceptance rate: 0.54
## genearation: 812000; mean acceptance rate: 0.36
## genearation: 813000; mean acceptance rate: 0.33
## genearation: 814000; mean acceptance rate: 0.3
## genearation: 815000; mean acceptance rate: 0.24
## genearation: 816000; mean acceptance rate: 0.24
## genearation: 817000; mean acceptance rate: 0.25
## genearation: 818000; mean acceptance rate: 0.27
## genearation: 819000; mean acceptance rate: 0.24
## genearation: 820000; mean acceptance rate: 0.22
## genearation: 821000; mean acceptance rate: 0.05
## genearation: 822000; mean acceptance rate: 0.11
## genearation: 823000; mean acceptance rate: 0.07
## genearation: 824000; mean acceptance rate: 0.06
## genearation: 825000; mean acceptance rate: 0.04
## genearation: 826000; mean acceptance rate: 0.08
## genearation: 827000; mean acceptance rate: 0.07
## genearation: 828000; mean acceptance rate: 0.09
## genearation: 829000; mean acceptance rate: 0.12
## genearation: 830000; mean acceptance rate: 0.1
## genearation: 831000; mean acceptance rate: 0.49
## genearation: 832000; mean acceptance rate: 0.47
## genearation: 833000; mean acceptance rate: 0.47
## genearation: 834000; mean acceptance rate: 0.39
## genearation: 835000; mean acceptance rate: 0.34
## genearation: 836000; mean acceptance rate: 0.28
## genearation: 837000; mean acceptance rate: 0.28
## genearation: 838000; mean acceptance rate: 0.25
## genearation: 839000; mean acceptance rate: 0.22
## genearation: 840000; mean acceptance rate: 0.23
## genearation: 841000; mean acceptance rate: 0.29
## genearation: 842000; mean acceptance rate: 0.14
## genearation: 843000; mean acceptance rate: 0.09
## genearation: 844000; mean acceptance rate: 0.11
## genearation: 845000; mean acceptance rate: 0.13
## genearation: 846000; mean acceptance rate: 0.22
## genearation: 847000; mean acceptance rate: 0.27
## genearation: 848000; mean acceptance rate: 0.31
## genearation: 849000; mean acceptance rate: 0.29
## genearation: 850000; mean acceptance rate: 0.3
## genearation: 851000; mean acceptance rate: 0.6
## genearation: 852000; mean acceptance rate: 0.34
## genearation: 853000; mean acceptance rate: 0.29
## genearation: 854000; mean acceptance rate: 0.24
## genearation: 855000; mean acceptance rate: 0.22
## genearation: 856000; mean acceptance rate: 0.2
## genearation: 857000; mean acceptance rate: 0.24
## genearation: 858000; mean acceptance rate: 0.26
## genearation: 859000; mean acceptance rate: 0.3
## genearation: 860000; mean acceptance rate: 0.34
## genearation: 861000; mean acceptance rate: 0.49
## genearation: 862000; mean acceptance rate: 0.47
## genearation: 863000; mean acceptance rate: 0.49
## genearation: 864000; mean acceptance rate: 0.4
## genearation: 865000; mean acceptance rate: 0.37
## genearation: 866000; mean acceptance rate: 0.39
## genearation: 867000; mean acceptance rate: 0.4
## genearation: 868000; mean acceptance rate: 0.41
## genearation: 869000; mean acceptance rate: 0.39
## genearation: 870000; mean acceptance rate: 0.39
## genearation: 871000; mean acceptance rate: 0.17
## genearation: 872000; mean acceptance rate: 0.16
## genearation: 873000; mean acceptance rate: 0.11
## genearation: 874000; mean acceptance rate: 0.16
## genearation: 875000; mean acceptance rate: 0.14
## genearation: 876000; mean acceptance rate: 0.14
## genearation: 877000; mean acceptance rate: 0.18
## genearation: 878000; mean acceptance rate: 0.2
## genearation: 879000; mean acceptance rate: 0.21
## genearation: 880000; mean acceptance rate: 0.2
## genearation: 881000; mean acceptance rate: 0.09
## genearation: 882000; mean acceptance rate: 0.35
## genearation: 883000; mean acceptance rate: 0.34
## genearation: 884000; mean acceptance rate: 0.35
## genearation: 885000; mean acceptance rate: 0.34
## genearation: 886000; mean acceptance rate: 0.32
## genearation: 887000; mean acceptance rate: 0.27
## genearation: 888000; mean acceptance rate: 0.26
## genearation: 889000; mean acceptance rate: 0.23
## genearation: 890000; mean acceptance rate: 0.21
## genearation: 891000; mean acceptance rate: 0
## genearation: 892000; mean acceptance rate: 0
## genearation: 893000; mean acceptance rate: 0.14
## genearation: 894000; mean acceptance rate: 0.17
## genearation: 895000; mean acceptance rate: 0.21
## genearation: 896000; mean acceptance rate: 0.21
## genearation: 897000; mean acceptance rate: 0.21
## genearation: 898000; mean acceptance rate: 0.19
## genearation: 899000; mean acceptance rate: 0.19
## genearation: 900000; mean acceptance rate: 0.21
## genearation: 901000; mean acceptance rate: 0.38
## genearation: 902000; mean acceptance rate: 0.36
## genearation: 903000; mean acceptance rate: 0.36
## genearation: 904000; mean acceptance rate: 0.41
## genearation: 905000; mean acceptance rate: 0.4
## genearation: 906000; mean acceptance rate: 0.36
## genearation: 907000; mean acceptance rate: 0.34
## genearation: 908000; mean acceptance rate: 0.35
## genearation: 909000; mean acceptance rate: 0.34
## genearation: 910000; mean acceptance rate: 0.33
## genearation: 911000; mean acceptance rate: 0
## genearation: 912000; mean acceptance rate: 0.1
## genearation: 913000; mean acceptance rate: 0.16
## genearation: 914000; mean acceptance rate: 0.22
## genearation: 915000; mean acceptance rate: 0.28
## genearation: 916000; mean acceptance rate: 0.26
## genearation: 917000; mean acceptance rate: 0.28
## genearation: 918000; mean acceptance rate: 0.27
## genearation: 919000; mean acceptance rate: 0.27
## genearation: 920000; mean acceptance rate: 0.29
## genearation: 921000; mean acceptance rate: 0.29
## genearation: 922000; mean acceptance rate: 0.39
## genearation: 923000; mean acceptance rate: 0.29
## genearation: 924000; mean acceptance rate: 0.28
## genearation: 925000; mean acceptance rate: 0.26
## genearation: 926000; mean acceptance rate: 0.22
## genearation: 927000; mean acceptance rate: 0.19
## genearation: 928000; mean acceptance rate: 0.18
## genearation: 929000; mean acceptance rate: 0.16
## genearation: 930000; mean acceptance rate: 0.17
## genearation: 931000; mean acceptance rate: 0.06
## genearation: 932000; mean acceptance rate: 0.26
## genearation: 933000; mean acceptance rate: 0.33
## genearation: 934000; mean acceptance rate: 0.24
## genearation: 935000; mean acceptance rate: 0.19
## genearation: 936000; mean acceptance rate: 0.16
## genearation: 937000; mean acceptance rate: 0.14
## genearation: 938000; mean acceptance rate: 0.15
## genearation: 939000; mean acceptance rate: 0.13
## genearation: 940000; mean acceptance rate: 0.12
## genearation: 941000; mean acceptance rate: 0
## genearation: 942000; mean acceptance rate: 0
## genearation: 943000; mean acceptance rate: 0
## genearation: 944000; mean acceptance rate: 0.07
## genearation: 945000; mean acceptance rate: 0.05
## genearation: 946000; mean acceptance rate: 0.09
## genearation: 947000; mean acceptance rate: 0.16
## genearation: 948000; mean acceptance rate: 0.15
## genearation: 949000; mean acceptance rate: 0.16
## genearation: 950000; mean acceptance rate: 0.19
## genearation: 951000; mean acceptance rate: 0.82
## genearation: 952000; mean acceptance rate: 0.65
## genearation: 953000; mean acceptance rate: 0.7
## genearation: 954000; mean acceptance rate: 0.64
## genearation: 955000; mean acceptance rate: 0.6
## genearation: 956000; mean acceptance rate: 0.52
## genearation: 957000; mean acceptance rate: 0.44
## genearation: 958000; mean acceptance rate: 0.39
## genearation: 959000; mean acceptance rate: 0.36
## genearation: 960000; mean acceptance rate: 0.36
## genearation: 961000; mean acceptance rate: 0.41
## genearation: 962000; mean acceptance rate: 0.31
## genearation: 963000; mean acceptance rate: 0.21
## genearation: 964000; mean acceptance rate: 0.15
## genearation: 965000; mean acceptance rate: 0.18
## genearation: 966000; mean acceptance rate: 0.17
## genearation: 967000; mean acceptance rate: 0.18
## genearation: 968000; mean acceptance rate: 0.15
## genearation: 969000; mean acceptance rate: 0.2
## genearation: 970000; mean acceptance rate: 0.22
## genearation: 971000; mean acceptance rate: 0.26
## genearation: 972000; mean acceptance rate: 0.26
## genearation: 973000; mean acceptance rate: 0.17
## genearation: 974000; mean acceptance rate: 0.2
## genearation: 975000; mean acceptance rate: 0.24
## genearation: 976000; mean acceptance rate: 0.27
## genearation: 977000; mean acceptance rate: 0.32
## genearation: 978000; mean acceptance rate: 0.35
## genearation: 979000; mean acceptance rate: 0.38
## genearation: 980000; mean acceptance rate: 0.38
## genearation: 981000; mean acceptance rate: 0.56
## genearation: 982000; mean acceptance rate: 0.55
## genearation: 983000; mean acceptance rate: 0.48
## genearation: 984000; mean acceptance rate: 0.45
## genearation: 985000; mean acceptance rate: 0.4
## genearation: 986000; mean acceptance rate: 0.35
## genearation: 987000; mean acceptance rate: 0.31
## genearation: 988000; mean acceptance rate: 0.29
## genearation: 989000; mean acceptance rate: 0.28
## genearation: 990000; mean acceptance rate: 0.26
## genearation: 991000; mean acceptance rate: 0.02
## genearation: 992000; mean acceptance rate: 0.09
## genearation: 993000; mean acceptance rate: 0.06
## genearation: 994000; mean acceptance rate: 0.09
## genearation: 995000; mean acceptance rate: 0.16
## genearation: 996000; mean acceptance rate: 0.2
## genearation: 997000; mean acceptance rate: 0.2
## genearation: 998000; mean acceptance rate: 0.22
## genearation: 999000; mean acceptance rate: 0.21
## genearation: 1000000; mean acceptance rate: 0.2
## Done MCMC.

Even though we didn't plot the likelihood trace as we were running the MCMC, we can still plot it from the object.

plot(mcmc)

plot of chunk unnamed-chunk-10

Remember, here we simulated a negative correlation of 0.8. Let's look at our posterior distribution for r:

plot(density(mcmc))

plot of chunk unnamed-chunk-11

It should be surprising to see that it is broader than it was in the prior case - because, remember, we are dealing with two discrete characters now, which should thus contain less information about the correlation than one continuous and one discrete trait.

Users may find that the MCMC does not perform as well for smaller trees. I don't know what to say about that. Mostly, I suspect it is because in the threshold model we have a posterior density that is quite flat, which makes the MCMC move around a lot - but I'm not sure that's it.

Cool.

3 comments:

  1. Dear Liam,

    It seems that threshBayes is only able to deal with binary or continuous traits at the moment. I am wondering whether it would be possible to test in a similar way the correlation between two multi-state discrete traits?

    Best,
    Sandra.

    ReplyDelete
    Replies
    1. Hi Sandra. Unfortunately not. Something that I've seen done is that people use phytools::ancThresh to generate a posterior distribution of liabilities for the tips of a tree for their multi-state character, and then use this distribution (or its mean or median) in other analyses. This seems pretty reasonable, but I don't know if it is theoretically well-justified. - Liam

      Delete
    2. Hi Liam,
      Thank you for your reply, I was thinking about doing that as well.

      Best,
      Sandra.

      Delete

Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.