Re: [R-sig-phylo] estimating the evolutionary rate of a continous trait

2016-04-15 Thread Hunt, Gene
Hi Belinda,

I agree with Brian�s comment.  I�d also add the more general point that OU 
models don�t really have a clearly interpretable rate parameter in the same way 
that BM models do.  In BM models, the sigma parameter controls the pace of 
trait evolution: the expected change over a given time interval depends 
strightforwardly on sigma (and only on sigma).

OU models also have a sigma parameter that has the same meaning � it is the 
variance of the diffusion process.  But, it is perilous to interpret it in the 
OU context as a rate parameter as one would for BM. This is because the 
expected change over a given interval depends on sigma, but also on alpha and 
the distance to the optimum.  This complexity means that OU models don�t have 
any single number you can point to as a generic rate of change for the process.

So, if your scientific question hinges on saying something about rates on 
branches, I think this is all the more reason to follow Brian�s suggestion of 
looking into one of the BM rate heterogeneity methods.

Best,
Gene

--
Gene Hunt
Curator, Department of Paleobiology
National Museum of Natural History
Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012
Washington DC 20013-7012
Phone: 202-633-1331  Fax: 202-786-2832
http://paleobiology.si.edu/staff/individuals/hunt.cfm

From: Brian O'Meara >
Reply-To: "omeara.br...@gmail.com" 
>
Date: Friday, April 15, 2016 at 11:00 AM
To: Belinda Kahnt >, "mailman, 
r-sig-phylo" >
Subject: Re: [R-sig-phylo] estimating the evolutionary rate of a continous trait

Hi, Belinda.

One thing to watch is over-intepretation: BM is consistent with drift, OU
is consistent with selection, but various kinds of selection can also lead
to BM. [1]. A lot of the people involved in these methods (including me)
are guilty of sloppiness in language in this area, leading to confusion.

Also, another issue could be branch lengths: are they proportional to time
(or, arguably, something like number of generations)? All these methods are
basically stretching the tree in various ways (and, for OU, adjusting
expected means), so if branch lengths are arbitrary, so are the results. I
ask due to the lambda fit. Other things that can cause this are
unincorporated measurement error (b/c it looks like a lot of evolution
right at the tips, meaning little evolution along the branches). I'd
suggest incorporating this (you can give known estimates of measurement
error; some programs allow this to be estimated as well (I forget whether
we have the estimation bit exposed in OUwie, but known error should be
there at least)).

Surface can estimate different regimes on the tree, but IIRC it does not
estimate different rates, just OU means. I believe auteur (in geiger) and
BAMM can model different BM rates on different branches, which sounds like
your question. We have some code to try different OU models (including
perhaps ones with different rates) on different branches buried somewhere
in OUwie (we call it OUwie-dredge so people know to be cautious) but it
hasn't been tested or published yet.

One other caution: if you have a BM model, and are just modeling different
rates, it can be done well. Trying to estimate different rates with OU
models is harder to do well: there's interaction between alpha and sigma
that can make them difficult to distinguish (not formally nonidentifiable
[unlike OU means sometimes], just difficult). For me, I'd probably lean
towards one of the BM rate heterogeneity methods for your question.

Hope this helps,
Brian


[1] Hansen, T. F. and E. P. Martins. 1996. Translating between
microevolutionary process and macroevolutionary patterns: the correlation
structure of interspecific data. Evolution 50:1404-1417.

___
Brian O'Meara
Associate Professor
Dept. of Ecology & Evolutionary Biology
U. of Tennessee, Knoxville
http://www.brianomeara.info



On Fri, Apr 15, 2016 at 10:20 AM, Belinda Kahnt 
> wrote:

Dear all,
I am a newbie to this mailing list and phylogenetic analyses in R and hope
you can comment on a question I have. I would like to estimate the rate of
evolution of a continous trait and check if the trait evolves faster along
some branches of the topology. I already checked with Pagels lambda if the
trait evolves according to a Brownian motion model,(i.e. pure drift), which
it did not (lambda ~ 0). Modelling the trait evolution under the
Ornstein-Uhlenbeck (OU) model provided a significant better fit (p<- 0.01)
with a very high alpha parameter of 8.7 (indicating a role of selection in
trait evolution). In order to infer now the rate of trait evolution I am
searching for a R package that is able to do this inference based on the OU
model. 

Re: [R-sig-phylo] question about measurement error in phylogenetic signal

2013-07-08 Thread Hunt, Gene
Small follow-up to Liam's suggestion:  If you do use an arcsin transformation 
for proportional data, the variance of arcsin(sqrt(p)) is approximately 1/(4N), 
where p is the proportion and N is sample size.  The approximation is good 
unless the proportion is very close to 0 or 1.

Best,
Gene


--
Gene Hunt
Curator, Department of Paleobiology
National Museum of Natural History
Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012
Washington DC 20013-7012
Phone: 202-633-1331  Fax: 202-786-2832
http://paleobiology.si.edu/staff/individuals/hunt.cfm

From: Liam J. Revell liam.rev...@umb.edumailto:liam.rev...@umb.edu
Date: Sunday, July 7, 2013 3:10 PM
To: Xavier Prudent prudentxav...@gmail.commailto:prudentxav...@gmail.com
Cc: mailman, r-sig-phylo 
r-sig-phylo@r-project.orgmailto:r-sig-phylo@r-project.org
Subject: Re: [R-sig-phylo] question about measurement error in phylogenetic 
signal

Hi Eliot  Xavier.

I think that Xavier's suggestion is not a particularly good idea in this
case because random error will tend to depress phylogenetic signal. In
other words - random data error does not introduce random error in
phylogenetic signal, rather it biases phylogenetic signal towards 0.

A better approach is to incorporate error in the estimation of species
means directly - following Ives et al. (2007). This is implemented in
phylosig of the phytools package.

Your formula for the standard error of a proportion is indeed the
formula for the correct standard error given your data; however, it
raises the question of whether the assumed model (BM) is suitable for
your data (or perhaps this is what you are trying to find out). For
small samples (n30), some people have recommended an n+4 correction -
in which 2 successes and 2 failures are added during calculation of the
SE. If you are using an arcsine transformation, as is common for
proportion data, you need to be aware that your standard errors are on
the original scale! (I don't know the formula for standard errors on the
transformed scale.)

- Liam

Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edumailto:liam.rev...@umb.edu
blog: http://blog.phytools.org

On 7/4/2013 3:36 AM, Xavier Prudent wrote:
Dear Eliot,

One way to cope with the uncertainty on the inputs in an analysis is vary
these inputs by some amount (like +- 1 standard deviation) and rerun your
analysis. The spread of the result tells you then how robust your analysis
is.
Pay attention that the inputs may be varied in an independent way if they
ARE independent, if they highly correlated you may prefer to vary them
simultaneously.

Hope that helps,

Regards,
Xavier


2013/7/4 Eliot Miller eliotmil...@umsl.edumailto:eliotmil...@umsl.edu

Hello all,

I have been trying to get something to work in a number of different
packages and with a number of different approaches today that I couldn't
get to run in a believable way. Before I spend another day on this, I was
wondering what people think about the idea in general.

I have a dataset of disease prevalence across ~100 species. There are ~2000
individuals total across the dataset, with 4 individuals per species.
Prevalence per individual is coded as 0 or 1. I am interested in the
phylogenetic signal of disease prevalence across the species. One approach
that works is to simply calculate prevalence as the species-specific mean,
i.e. if 3 individuals of 6 for a species had the disease, the prevalence
would be 3/6 = 0.5. Then one can use these values with e.g. phylosig() (I
arcsin sqrt transformed these proportions here). Like the few other
published tests of phylogenetic signal in disease prevalence, there is
little signal here. I could leave it at that, because in general there are
very low detections in this dataset and it's probably not ideally suited to
address this question anyhow.

That aside however, because not all individuals of a given species always
have the disease, I wanted to incorporate measurement error. So, based on
the calculation for SE for binary data from the site:

http://www.researchgate.net/post/Can_standard_deviation_and_standard_error_be_calculated_for_a_binary_variable
,
I also calculated a species-specific SEs as the
sqrt(mean(prevalence)*((1-
mean(prevalence))/individuals)).

What do people think about this? It's hardly measurement error in the sense
we normally mean it. On the other hand, I think it would be neat if there
were some way to account for variation among individuals in prevalence, and
the influence this has on phylogenetic signal.

Cheers,
Eliot

  [[alternative HTML version deleted]]

___
R-sig-phylo mailing list - 
R-sig-phylo@r-project.orgmailto:R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at
http://www.mail-archive.com/r-sig-phylo@r-project.org/






___
R-sig-phylo 

Re: [R-sig-phylo] R: ancestral state reconstruction for tips

2011-08-05 Thread Hunt, Gene
Also, the issue of predicting values for unknown tips using data from other 
species in the tree is considered in this reference:

Garland, T., and A. R. Ives. 2000. Using the past to predict the present: 
confidence intervals for regression equations in phylogenetic comparative 
methods. American Naturalist 155(3):346-364.

Best,
Gene



On 8/5/11 11:31 AM, pasquale.r...@libero.it pasquale.r...@libero.it wrote:




Hi Morgan,

this is just stuff for thought, and remember, this is wrong anyway. But you
may try something like this:

1. compute pics,
2. take the pic value at the ancestral node subtending to your unknown tip,
3. pretend one of the two tips the pic was originally computed on is in fact
your unknown species,
4. modify the square of the summed branch lengths of the two species by using
the new bl,
5. use the formula for pics (standardized) to derive your unknown tip value by
using the other (real) species tip value and the new square of summed branch
lengthts


but again, remember this is wrong, because contrasts were computed without
your unknown species. With ace everything turns out to be much more complicated
because ancestral value estimations are 'optimized' by taking the entire tree
and distribution of values at once, so to speak.





Messaggio originale
Da: morgan.g.i.langi...@gmail.com
Data: 05/08/2011 14.15
A: r-sig-phylo@r-project.org
Ogg: [R-sig-phylo] ancestral state reconstruction for tips

I was wondering if there is a way to get ancestral state
reconstructions not for nodes within the tree but for tips that I
don't know the trait of.  I could do this somewhat manually, by taking
the ancestral state resconstruction from the parent and child nodes
surrounding where my unknown tip branches off from the tree and
averaging those results (weighted by the branch length). This approach
seems kind of clunky, so I was hoping there was something better.



Morgan Langille

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo



--
Gene Hunt
Curator, Department of Paleobiology
National Museum of Natural History
Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012
Washington DC 20013-7012
Phone: 202-633-1331  Fax: 202-786-2832
http://paleobiology.si.edu/staff/individuals/hunt.cfm

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


Re: [R-sig-phylo] Assigning node ages to a tree, revisited

2011-07-14 Thread Hunt, Gene
Roger,

If you like, go ahead and send me off-list your code and tree file.  The 
function does not do a lot of error checking, so it is probably hanging on tip 
or node names; an incorrect tree structure can flummox it, too.  If it is 
working ,it shouldn't take more than a few seconds.

Best,
Gene


On 7/14/11 12:15 AM, Scott Chamberlain myrmecocys...@gmail.com wrote:


 Hi Roger,

Can you provide a reproducible example (perhaps a subset of your tree and their 
tip and node ages if the tree is very large)? I don't know what the problem 
could be without the data, but perhaps Gene knows?


Scott


On Wednesday, July 13, 2011 at 10:57 PM, Roger Close wrote:


Hello all,

I wish to transform branch lengths on a tree according to ages of
terminal taxa and internal node ages; to this end I have tried to
implement the script written by Gene Hunt mentioned in a recent post
to this list 
(http://www.mail-archive.com/r-sig-phylo@r-project.org/msg01005.html;
script available at https://gist.github.com/938313).

However, when attempting to run the command scalePhylo(tr, tip.ages,
node.mins), it crunches away for hours on my computer (a 2010 MacBook
Pro Core i7, which is quite fast). Clearly there's something wrong.
I'm afraid I don't know enough about R to debug a script.

I thought I'd send this to the list in case someone other than Gene
Hunt or Scott Chamberlain has had a go at using this script.

Thanks in advance,

Roger









--
Gene Hunt
Curator, Department of Paleobiology
National Museum of Natural History
Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012
Washington DC 20013-7012
Phone: 202-633-1331  Fax: 202-786-2832
http://paleobiology.si.edu/staff/individuals/hunt.cfm

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


Re: [R-sig-phylo] Simulate node ages given known topology

2011-04-11 Thread Hunt, Gene
Hi Andy,

Brian Sidlauskas did this in an Evolution paper in 2008 (based on Yang and 
Rannala 1997):

Sidlauskas, Brian L. 2008. Continuous and arrested morphological 
diversification in sister clades of characiform fishes: a phylomorphospace 
approach. Evolution 62(12): 3135-3156.

He had a morphological tree without fossil or molecular branch lengths.  The 
branch lengths were based on rates of speciation, extinction and sampling, and 
so it would be a different approach than the coalescent theory, I believe.   I 
think Brian has R code for it; you may want to contact him directly.

Best,
Gene


On 4/11/11 12:04 PM, Andy Rominger ajromin...@gmail.com wrote:

Hi Emmanuel,

Many thanks for your suggestions.  I think a group of us at Berkeley would
be very interested in working out different ways to simulate these processes
and then share our results.  We'll keep you posted.  I think starting with
rcoal and compute.brlen would be a great jumping off place.

Thanks again,
Andy


On Mon, Apr 11, 2011 at 4:36 AM, Emmanuel Paradis
emmanuel.para...@ird.frwrote:

 Andy,

 Andy Rominger wrote on 09/04/2011 08:37:

  Hello,

 I'm working with a friend on a problem where we'd like to simulate
 many possible trees that all have the same topology, but differ in branch
 lengths (or equivalently in node ages).  We have a known age for the root,
 and all tips correspond to extant taxa.  So the start and end times are
 known.


 The code to do this is in rcoal() except that a random topology is
 generated. It seems several users are interested in assigning random
 branching times to a fixed topology, so I'll add this. compute.brlen() can
 generate random branch lengths on a fixed topology. What you want is a
 function that does the opposite operation of branching.times(). I can see
 three possible ways to implement this:

 1) add a new option to compute.brlen()
 2) add a new option to rcoal()
 3) write a new function, eg, compute.brtime()

 BTW, rcoal() can be used with fixed branching intervals (ie, computed
 beforehand) where a random coalescent topology is generated; so option 2
 makes sense to me. Any suggestion?


  I'm wondering if a function to produce random branch lengths under
 topological constraints already exists?  If not, I'm trying to dredge up
 my
 foggy knowledge of stochastic processes to write the simulation myself.
  I'm thinking that maybe I remember under a Yule process sojourn times are
 distributed exponential so event times should be uniformly distributed???
  But then I got pointed toward Yule priors which I still
 don't satisfactorily understand (but maybe eventually will) after a few
 web
 searches.


 Once you'll have the above tool (soon I hope), then you'll be able to
 explore this issue more freely. Be careful to distinguish branching times
 and branching intervals. (I'm just seeing that the help page of rcoal is not
 clear on this point: I'll clarify this.) If you simulate the latter, you get
 the former with cumsum(). ape has an internal function that computes the
 theoretical CDF of branching times under any birth-death process. eg:

 CDF.birth.death(.1, 0, Tmax = 10, x = 0:100/10, case = 1)

 will return the cumulative probability of the branching times 0, 0.1, 0.2,
 ..., 10 for lambda = 0.1 and mu = 0 (thus a Yule process). From this you can
 simulate a set of random branching times with the inverse method (generate
 runif(n) and back transform from the CDF). The literature reference is in
 ?bd.time. Of course, you can use another formula and compare the results
 with standard plots in R. As a reminder, rcoal() generates coalescent
 intervals with:

 2 * rexp(n - 1)/(as.double(n:2) * as.double((n - 1):1))

 You may also have a look at the package TreeSim which has algorithms
 contributed by Tanja Stadler.

 Cheers,

 Emmanuel

  Any insights would be greatly appreciated.  Thanks in advance--
 Andy

[[alternative HTML version deleted]]

 ___
 R-sig-phylo mailing list
 R-sig-phylo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


 --
 Emmanuel Paradis
 IRD, Jakarta, Indonesia
 http://ape.mpl.ird.fr/


[[alternative HTML version deleted]]

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo



--
Gene Hunt
Curator, Department of Paleobiology
National Museum of Natural History
Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012
Washington DC 20013-7012
Phone: 202-633-1331  Fax: 202-786-2832
http://paleobiology.si.edu/staff/individuals/hunt.cfm

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo


Re: [R-sig-phylo] Assign node ages to a tree

2011-03-11 Thread Hunt, Gene
Scott,

I have written a function to transform branch lengths on a tree according to 
age constraints in the terminal taxa and (optionally) the nodes (attached).  If 
your phylo object is tr, the command

scalePhylo(tr, tip.ages, node.mins)

will return a phylo object with new branch lengths scaled to the age 
constraints.  Ages are positive numbers (e.g., in Ma).  If all your taxa are 
extant, set tip.ages to be a vector of zeroes.  The argument node.mins can have 
NA entries for nodes without constraints.

I developed this for paleontological trees so the tip ages usually constrain 
branch lengths as well.  This may not work exactly as you would like for trees 
of extant species with only some of the nodes constrained (some internal nodes 
can be pushed up to the recent).

You may also want to look at Graeme Lloyd's function for doing this, which 
handles zero-length branches in a more elegant way:  
http://www.graemetlloyd.com/methdpf.html.  Again, this was designed for 
paleontological applications, so it might not get you exactly what you need.  
The code may be a useful starting point, though.

Best,
Gene


On 3/11/11 10:01 AM, Scott Chamberlain myrmecocys...@gmail.com wrote:

Hello,


We have trees for which we have estimated node ages for many nodes (but not all 
nodes in any one tree). We would like to assign node ages to the trees, and 
then later transform branch lengths according to node ages. How does one assign 
node ages in R?


Thanks, Scott Chamberlain
[[alternative HTML version deleted]]

___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo



--
Gene Hunt
Curator, Department of Paleobiology
National Museum of Natural History
Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012
Washington DC 20013-7012
Phone: 202-633-1331  Fax: 202-786-2832
http://paleobiology.si.edu/staff/individuals/hunt.cfm


Tree-node-ages.R
Description: Tree-node-ages.R
___
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo