Hi Lara,

You’re right that there is currently no function in an R package to do what you 
want. You could write a function to split the variance-covariance matrix of 
your tree, rescale the 3 epoch matrices separately, and then add them back 
together and perform ancestral state reconstruction using that vcv. I did 
something similar (part OU part BM) in this 
paper<http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12201/abstract> - 
see the R code on Dryad for how. It could easily be tweaked to get OU to OU 
(and even then to OU again!)

But, I think that this won’t do exactly what you want either because the regime 
thetas will not be accounted for — you will be getting node states for a single 
peak model where sigmasq and alpha are allowed to vary over time. To do exactly 
what you want, you’ll need a function that computes ancestral states under a 
multi-peak, multi-sigmasq, multi-alpha OU model, and I don’t believe this is 
currently possible in any R package. It is likely possible to tweak OUwie’s 
code to do this.

One alternative way I can think of doing this is to just add zero length (or 
very very short) branches to each node in the tree, perform many simulations 
using OUwie.sim with your MLE’s for the model parameters, and then compute the 
means from the resulting matrix of zero length branch (=node) states. These 
means could be passed, for example, to phytools phenogram function for plotting 
trait values through time.

cheers,

Graham


------------------------------------------------------------
Graham Slater
Peter Buck Post-Doctoral Fellow
Department of Paleobiology
National Museum of Natural History
The Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012


(202) 633-1316
[email protected]<mailto:[email protected]>
www.fourdimensionalbiology.com<http://www.fourdimensionalbiology.com>





On Nov 6, 2014, at 7:14 PM, Lara Budic 
<[email protected]<mailto:[email protected]>> wrote:

Hi Julien, Liam

Thanks a lot for your suggestions!

As I see it, make.era.map will define 3 different
time-periods on the tree.
ouwie.sim could then simulate continuous trait evolution
under those time-periods, based on previously fitted alpha,
sigma2 and and optima for each individual regime.
And this could maybe be used to test for model adequacy (as
described in Pennel et al 2014) by comparing simulated data
to the original data.
But I am not sure if it works correctly for era.maps.
Also, I suppose this simulated evolution cannot be plotted.
If the simulation gives as output only the tip values,
without transforming the tree 'phenogram' will reconstruct
a BM evolution.

This is what I struggle with, but let me explain better my
original question!
I have estimates of alpha, sigma2 and theta for each regime
which were fitted with OUwie.slice.
I would like to visualize the trait evolution according to
this model with the real data.

The usual way is to rescale the tree and reconstruct the
trait on it, I wonder if there is a way to rescale each
slice of the era.map with different parameters?
I guess this can be done with vcv matrices, but is a bit
tricky given that some branches are sliced and the two
halves have different set of parameters?
Is this feasible somehow? Hopefully...

Thanks a lot again

All the best,
Lara

On Wed, 5 Nov 2014 23:28:55 +0100
Julien Clavel <[email protected]<mailto:[email protected]>> wrote:
Oh yes! I forgot OUwie! This is definitely the easiest
way for this kind of simulations with make.era.map.
But I think that fitting OU models on several time bin is
not the best idea with ultrametric trees.

Julien

Envoyé de mon iPad

Le 5 nov. 2014 à 18:30, "Liam J. Revell"
<[email protected]<mailto:[email protected]>> a écrit :

Hi Lara.

I have not tried this myself, but theoretically you
should be able to use make.era.map in phytools to paint
different regimes to different time periods; and then
OUwie.sim (with simmap.tree=TRUE) in the OUwie package to
simulate different OU process in different regimes. Let
us know if this works.

All the best, Liam

Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: [email protected]<mailto:[email protected]>
blog: http://blog.phytools.org

On 11/5/2014 12:21 PM, Lara Budic wrote:
Hi Julien,

thank you for your suggestions! I also thought of
using make.era.map.
As I understand it, it is possible to transform each
slice according to different rates by multiplying the
branch lengths, but I am still struggling to transform
different time-periods according to a different alpha
value.

Basically I would like to visualize trait evolution in
which each time period has a different alpha and sigma2.
I still haven't find a way but I will explore the
options in phytools then, thanks.


Lara


On 3 Nov 2014, at 19:44, Julien Clavel wrote:

Hi Lara,

You can use the make.era.map function in phytools to
slice your tree in simmap like format. Then you multiply
the mapped time slices by the required rate (eg,
tree$mapped.edge[,1]*sigma) and then use
tree$edge.length<-rowSum(tree$mapped.edge) or something
like that.

HTH

Julien

From: [email protected]<mailto:[email protected]>
To: [email protected]<mailto:[email protected]>
Date: Mon, 3 Nov 2014 18:36:34 +0100
Subject: [R-sig-phylo] Rescaling trees

Hello R Phylo list

I have a question regarding rescaling trees.

"rescale" function in geiger has an option to
rescale the
tree in which different time slices have a different
rate
of evolution.

I would like to rescale each time slice with a
different
rate but also with a specific alpha parameter (for a
time-dependent OU model).

Do you know if that would be possible somehow?

I will greatly appreciate any thoughts and
suggestions.



Lara Budic
PhD student at Biometry and Environmental System
Analysis
Faculty of Environment and Natural Resources
University of Freiburg
Tennenbacherstr. 4
79106 Freiburg i. Br.

_______________________________________________
R-sig-phylo mailing list - 
[email protected]<mailto:[email protected]>
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at
http://www.mail-archive.com/[email protected]/


  [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at
http://www.mail-archive.com/[email protected]/


Lara Budic
PhD student at Biometry and Environmental System Analysis
Faculty of Environment and Natural Resources
University of Freiburg
Tennenbacherstr. 4
79106 Freiburg i. Br.

_______________________________________________
R-sig-phylo mailing list - 
[email protected]<mailto:[email protected]>
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - [email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/[email protected]/

Reply via email to