xavierdidelot / BactDating

Bayesian inference of ancestral dates on bacterial phylogenetic trees
https://xavierdidelot.github.io/BactDating
MIT License
80 stars 15 forks source link

Bactdating convergence and root to tip plot #48

Closed LeonardosMageiros closed 2 years ago

LeonardosMageiros commented 2 years ago

Hi,

As I am new to bactdating I am trying to understand if my results are ok.

I executed bactating using the output of clonalframeML in ~1500 S aureus strains using the command: res=bactdate(unroot(rooted),dates,nbIts=1e5, useRec=T)

The trace plots of this run look like that: image

If I understand correctly to have good results we are looking for cases where the parameters have a similar mean and variance. Is that correct? If yes my plots dont look that good. Should I rerun bactdate with a higher nbIts value?

Additionally can you explain me briefly how I can translate the root to tip plots? Is the gola to see an even spread of points within the dotted lines. If yes can you let me know how I can explain my plot:

image

Thank you very much in advance for your time Best Leonardos

xavierdidelot commented 2 years ago

Hi Leonardos,

These MCMC trace plots look not bad at all. You want to see each plot stabilising after 50% of the run (since the first 50% of the run is being discarded as MCMC burnin) and here you can see it's roughly the case. You could of course increase the number of iterations, and also do multiple runs to check they agree, but as a first run it looks promising.

The root-to-tip plot is only a really rough way of capturing the temporal signal, which here was found to be significant (p<1e-4) but the scatter plot is very messy and so this is not really meaningful. There are at least two assumptions in the root-to-tip plot that make it a rough approach: it's assuming that tips are independent which never true due to the tree structure, and it's assuming that the clock is strict which is often not true and certainly not true in your case. The MCMC is a much more powerful way of analysis which does not have these restrictions.

Best wishes, Xavier

LeonardosMageiros commented 2 years ago

Xavier thank you very much for that. Very helpful explanation.

Best wishes Leonardos