Discussion:
[R-sig-phylo] Simulating tree from a given tree
M***@ext.uv.es
2018-07-29 09:06:30 UTC
Permalink
Hi list:

Is there any function to simulate a tree from a given tree?. For example, I have a tree encompassing 10 Million years and I would like to simulate the "growth" of such tree for the following 5 MY.

Thanks in advance

Miguel Verdú

--
********************************************************************
Centro de Investigaciones sobre Desertificacion
(CSIC-UV-GV)
Carretera Moncada - Náquera, Km. 4,5
Apartado Oficial
46113 Moncada (Valencia)
Spain
Tel +34 96 3424204
Fax +34 96 3424160
www.uv.es/verducam

_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-***@r-project.org/
Eduardo Ascarrunz
2018-07-30 12:58:35 UTC
Permalink
Maybe you could use a birth-death model. You can estimate the speciation
rate and extinction rate from your original tree, and use those parameters
to run simulations of trees for 5 My with the pbtree function from
phytools. Run as many simulations as you have living tips in your original
tree, and bind each simulated tree to one of the living tips. It shouldn't
be too difficult to write a wrapper function to perform all those steps.

Cheers,

Eduardo
Post by M***@ext.uv.es
Is there any function to simulate a tree from a given tree?. For example,
I have a tree encompassing 10 Million years and I would like to simulate
the "growth" of such tree for the following 5 MY.
Thanks in advance
Miguel Verdú
--
********************************************************************
Centro de Investigaciones sobre Desertificacion
(CSIC-UV-GV)
Carretera Moncada - Náquera, Km. 4,5
Apartado Oficial
46113 Moncada (Valencia)
Spain
Tel +34 96 3424204
Fax +34 96 3424160
www.uv.es/verducam
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-
[[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-***@r-project.org/
Liam J. Revell
2018-07-30 13:40:00 UTC
Permalink
Dear Miguel & Eduardo.

This is correct, except that you should keep in mind that pbtree (like
most, but not all, such simulators) generates trees from the first
speciation event. Thus, the correct procedure must first involve drawing
a wait time from an exponential distribution, deciding if the next event
was a speciation or an extinction, attaching a stem to the base tree,
and then (if the event was a speciation) simulating a birth-death tree
to attach to this stem.

The algorithm would thus be something like:

1. Decide on a desired total height for the tree, h. (If, say, the tree
has a current total height/depth of 100, this could be any value >100.)
2. Go to a tip in the base tree. Compute it's height, t1.
3. Draw a random value from an exponential distribution, t2, with rate
b+d for birth rate b & death rate d.
4. If t1+t2<h, add length t2 to the current tip and advance to 5.
Otherwise, add h-t1 to the current tip and go to 2 for the next tip.
5. Decide if the current event is a speciation or extinction event. Draw
a random value from a uniform distribution on (0,1). If that value is
greater than b/(b+d) you are done with this tip: go back to step 2 for
the next tip. Otherwise, advance to step 6.
6. Compute t3=h-(t1+t2). Simulate a birth-death tree for t3 with birth &
death rates b & d. Attach the b/d tree to the current tip. Advance to
the next tip & go back to step 2.

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
Post by Eduardo Ascarrunz
Maybe you could use a birth-death model. You can estimate the speciation
rate and extinction rate from your original tree, and use those parameters
to run simulations of trees for 5 My with the pbtree function from
phytools. Run as many simulations as you have living tips in your original
tree, and bind each simulated tree to one of the living tips. It shouldn't
be too difficult to write a wrapper function to perform all those steps.
Cheers,
Eduardo
Post by M***@ext.uv.es
Is there any function to simulate a tree from a given tree?. For example,
I have a tree encompassing 10 Million years and I would like to simulate
the "growth" of such tree for the following 5 MY.
Thanks in advance
Miguel Verdú
--
********************************************************************
Centro de Investigaciones sobre Desertificacion
(CSIC-UV-GV)
Carretera Moncada - Náquera, Km. 4,5
Apartado Oficial
46113 Moncada (Valencia)
Spain
Tel +34 96 3424204
Fax +34 96 3424160
www.uv.es/verducam
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
_______________________________________________
R-sig-phylo mailing list - R-sig-***@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-***@r-project.org/
Loading...