Re: [R-sig-phylo] simulate traits evolution in correlated with body mass

2012-07-25 Thread Luke Matthews
: 3 Date: Tue, 24 Jul 2012 13:25:45 -0500 From: Andrew Barr wab...@gmail.com To: r-sig-phylo@r-project.org Subject: [R-sig-phylo] simulate traits evolution in correlated with body mass Message-ID: CABo4eqvJVyTX69GZSjvX-gMT3yhuDc=fy7gf2jqupgpmwd0...@mail.gmail.com Content-Type: text

[R-sig-phylo] simulate traits evolution in correlated with body mass

2012-07-24 Thread Andrew Barr
Hello everyone, I have a tree, with body mass data for the tip taxa. I am interested in simulating the evolution of continuous traits by BM that are correlated with body mass. I want to use the body mass tip data that I have to inform the character simulation, so that my resulting simulated tip

Re: [R-sig-phylo] simulate traits evolution in correlated with body mass

2012-07-24 Thread Liam J. Revell
Hi Andrew. For desired correlation r, size data x, and tree you could just do: library(phytools) y-r*x+sqrt(1-r^2)*fastBM(tree) This should give you the correlation r on average and the y|x should be Brownian. (If x is Brownian, then both y x y|x will be too.) - Liam Liam J. Revell,

Re: [R-sig-phylo] simulate traits evolution in correlated with body mass

2012-07-24 Thread Liam J. Revell
Actually, modify my previous email. That only works for sig^2(x)=1.0. It should be: library(phytools) y-r*x+sqrt(1-r^2)*fastBM(tree,sig2=mean(pic(x,tree)^2)) - Liam Liam J. Revell, Assistant Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/

Re: [R-sig-phylo] simulate traits evolution in correlated with body mass

2012-07-24 Thread Joe Felsenstein
Liam Revell wrote: library(phytools) y-r*x+sqrt(1-r^2)*fastBM(tree,sig2=mean(pic(x,tree)^2)) This should give you the correlation r on average and the y|x should be Brownian. (If x is Brownian, then both y x y|x will be too.) If y is evolving in response to x, and x is changing