Phenotypic trait evolution - running MCMC - very low Effective sample sizes

167 views
Skip to first unread message

Nachiket Shankar

unread,
Jul 27, 2014, 11:45:35 PM7/27/14
to bamm-p...@googlegroups.com
Dear All, 

I am running the "phenotypic trait evolution" model in bamm for my dataset - which comprises of a bacterial phylogeny of 1451 taxa. I assume my trait is a continuous trait - as it is the gene copy number of several bacteria - I have gone through the documentation and have used priors obtained from "setBAMMpriors" - in BAMMtools package in R. 

However, despite running it for 10^8 generations I am not getting convergence of the mcmc sample - and my ESS's are really bad. 

I have attached the trait data and control file - along with all the output files. 

Please let me know if you can help.

Thanks! :) 

myPriors.txt
TAC_mcmc_out.txt
TAC_prior_probs.txt
TAC_run_info.txt
trait_data.txt
traitcontrol.txt

Dan Rabosky

unread,
Aug 12, 2014, 3:06:02 PM8/12/14
to bamm-p...@googlegroups.com
Dear Nachiket-

Sorry for the slow reply. I think this strange behavior results from the fact that your data violate the assumption of the Brownian motion model. Basically, you are modeling a discrete character with a model for continuous data. Because you have huge areas of your tree with the same character state (1), the maximum likelihood estimate of all the Brownian motion parameters basically goes to 0, and likelihood across the tree continues to increase. It's like this: imagine you have a single branch on your tree, where you have state 1 at the ancestral node, and state 1 at a descendant node. This is a change in phenotype of 0, and you could make your likelihood (in principle) arbitrarily large by causing the Brownian rate parameter to go to zero on that branch. 

Normally, this doesn't happen, because there is enough variation in phenotypes across the tree with most continuous data that the rate parameter is forced to be large enough to accommodate phenotypic change. 

In your case, you have maybe 1000 or more branches where there is probably a change in 0 of phenotype. So BAMM tries to put a rate of 0 on those branches, and the closer that rate gets to (and the smaller the phenotypic change), the higher the likelihood. 

My impression is that BAMM is actually doing pretty well - it's finding the best model for your data, but your data are just pretty strange. 

If I'm right, you should be able to improve performance by adding some random noise to each data point. Your data are integers. So, I suggest making them "quasi-continuous". 

Take your data vector, and to each element, add a small random number, from a uniform distribution. if xx is a vector of your integer-valued data, do:

xx <- runif(length(xx), min = -0.25, max = 0.25)

and you'll fuzz your data a bit. I expect BAMM will do much better after this.

If your data are unordered (e.g., 1 is no more similar to 2 than it is to 5), then everything I wrote above does not apply, and you can't use BAMM on these data (yet).

Not everyone is likely to agree with this approximation, though I think it can be a reasonable solution to an otherwise difficult problem, as long as you are explicit about what you've done. You can try different amounts of noise and see if it matters, but I expect that your qualitative results will not change too much.
 
~Dan

Juan Daniel Vásquez-Restrepo

unread,
May 5, 2023, 7:40:39 PM5/5/23
to bamm-project
Dear Dr. Rabosky.

I found this answer from 2014 to be really helpful. Currently, I am using BAMM to analyze two traits, one of which is numerical and discrete (ordered), and I faced the same problem as the author of this post. I know that BAMM is not designed for this type of trait, but upon checking my results, the noise does not seem to alter the general result I was expecting. In my case, just adding a lower amount of noise was enough to achieve convergence and minimal ESS, passing from more than 1 x 10^8 generations without convergence, to 5 x 10^7.

Would you mind if I add your answer as a personal comment in my manuscript? I am not sure if in these almost 9 years since your answer, someone has applied it in a published article that I can use to justify my choice. However, in case it does not, it would be very useful for me to justify it as a suggestion from the person who knows best how this type of analysis works.

Wishes.
Reply all
Reply to author
Forward
0 new messages