Re: [R-sig-phylo] ancestral state reconstruction with fixed internal node(s)

2011-07-05 Thread Annemarie Verkerk

Dear Alejandro, Paolo, and Liam,

thanks so much for your feedback on this - I was able to get Liam's 
method to work on my trees and data. Very useful to be able to do!


Alejandro is right about BayesTraits, but indeed my data is continuous, 
so I was disappointed to find out that BayesTraits only takes discrete 
values. But of course, everything is possible with R!


The only thing that I'm still curious about is whether it would be 
possible to set a range of values for this ancestral state, rather than 
a single value. As Liam points out, we have to be quite confident in 
this ancestor and the value that we assign to it in order to have some 
confidence in our reconstructions. Of my ancestor I'm quite sure as 
there is historical data pointing to its existence. However, I think it 
would increase my confidence in the analysis if I could assign a range 
of values, i.e. something like 0.3-0.5, to this taxon. Or even better, a 
range of values associated with a normal distribution, so 0.3-0.5 would 
all be equally likely, with 'sloping' sides on both sides of the range 
that indicate increasingly less likely values. Since my data is 
continuous, this somehow seems like a more realistic analysis to me.


However, I don't know whether this is even possible, as I can imagine it 
would increase the complexity of the ancestral state reconstruction 
immensely.


If you have any ideas on this, I would be very happy to hear them - and 
thanks again for the earlier feedback!

Annemarie

Liam J. Revell wrote:

Hi Annemarie,

I do think this makes sense - *if* (and this may be a big if, 
depending on your data) we have a value for a hypothetical ancestor 
for which we are very confident and which we are sure belongs at a 
particularly ancestral node.


In that case, you could indeed use ace() by assigning attaching a zero 
length tip edge to the internal node of interest.


To illustrate this using an example, let's do the following:

# first generate a pure-birth tree using birthdeath.tree in geiger
tree-drop.tip(birthdeath.tree(b=1,d=0,taxa.stop=21),21)

# now plot the tree with internal node numbers
plot(tree); nodelabels(length(tree$tip)+1:tree$Nnode)

# now let's simulate on the tree using fastBM() from my phytools package
# (not on CRAN, but http://anolis.oeb.harvard.edu/~liam/R-phylogenetics)
# in this case we know the ancestral states if we set internal=TRUE
x-fastBM(tree,internal=T)
y-x[1:length(tree$tip)] # only the tip states

# now, let's say we want to attach the tip to node 22 in this case
tip-list(edge=matrix(c(2L,1L),1,2),tip.label=22,edge.length=0,Nnode=1L) 


class(tip)-phylo
atree-multi2di(bind.tree(tree,tip,where=22))
z-c(y,x[22])

# now let's estimate ancestral states - we can do this using
# method=gls
res.gls-ace(z,atree,method=GLS,corStruct=corBrownian(1,atree))

Keep in mind that the node numbers in tree and atree are different 
(because the latter has a different number of tips) *and* we have a 
different number of them (because we used multi2di() to fully resolve 
our multifurcating tree after we attached the extra tip).


Hope this helps.

- Liam



--
Annemarie Verkerk, MA
Evolutionary Processes in Language and Culture (PhD student)
Max Planck Institute for Psycholinguistics
P.O. Box 310, 6500AH Nijmegen, The Netherlands
+31 (0)24 3521 185
http://www.mpi.nl/research/research-projects/evolutionary-processes

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


[R-sig-phylo] ancestral state reconstruction with fixed internal node(s)

2011-06-30 Thread Annemarie Verkerk

Dear phylo-sig list people,

I want to do ancestral state reconstruction (preferably with ace) with 
one (or more) of the internal nodes 'fixed' for a range / a distribution 
of values. For instance, I want a node leading to one particular clade 
that is present a subset of my trees to have a value from 0.2-0.5, and 
then do the ancestral state reconstruction with this restriction on that 
node.


I have been searching the archives and the net for discussion of this 
(but maybe with the wrong search terms), and I cannot find anything 
about it - not how to do it in R or in any other package.


Thanks for your input!
Annemarie

--
Annemarie Verkerk, MA
Evolutionary Processes in Language and Culture (PhD student)
Max Planck Institute for Psycholinguistics
P.O. Box 310, 6500AH Nijmegen, The Netherlands
+31 (0)24 3521 185
http://www.mpi.nl/research/research-projects/evolutionary-processes

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


Re: [R-sig-phylo] ancestral state reconstruction with fixed internal node(s)

2011-06-30 Thread ppiras
Hi AnneMarie,
I dont really know if this makes sense; in fact
ancestral state reconstruction is an ** a posteriori
estimation ** of nodal values starting from tips
observations.

A trick could be to add a false taxon lnked to that
node  and giving to it a 0 branch length (i.e.
plitomized - you can then resolve this during
computation using multi2di() ) and assigning your
desired trait value.

I'm not sure if this helps

Best
Paolo






Dear phylo-sig list people,

I want to do ancestral state reconstruction
(preferably with ace) with
one (or more) of the internal nodes 'fixed' for a
range / a distribution
of values. For instance, I want a node leading to one
particular clade
that is present a subset of my trees to have a value
from 0.2-0.5, and
then do the ancestral state reconstruction with this
restriction on that
node.

I have been searching the archives and the net for
discussion of this
(but maybe with the wrong search terms), and I cannot
find anything
about it - not how to do it in R or in any other
package.

Thanks for your input!
Annemarie

--
Annemarie Verkerk, MA
Evolutionary Processes in Language and Culture (PhD
student)
Max Planck Institute for Psycholinguistics
P.O. Box 310, 6500AH Nijmegen, The Netherlands
+31 (0)24 3521 185
http://www.mpi.nl/research/research-projects/evolutionary-processes

___
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


Re: [R-sig-phylo] ancestral state reconstruction with fixed internal node(s)

2011-06-30 Thread Graham Slater

Hi AnneMarie,

The way Paolo suggests would be the best/right way to do this. We're 
working on some methods for incorporating fossil info in comparative 
methods and I have some code that will do this that i can send you 
off-list if you would like. I should add that, at least based on what 
we've found so far, doing this probably won't make much difference to 
your reconstructed ancestral states, simply because under BM, your CIs 
are so wide without constraining nodes that doing so has little effect.


best,

Graham

On 06/30/2011 09:40 AM, ppi...@uniroma3.it wrote:

Hi AnneMarie,
I dont really know if this makes sense; in fact
ancestral state reconstruction is an ** a posteriori
estimation ** of nodal values starting from tips
observations.

A trick could be to add a false taxon lnked to that
node  and giving to it a 0 branch length (i.e.
plitomized - you can then resolve this during
computation using multi2di() ) and assigning your
desired trait value.

I'm not sure if this helps

Best
Paolo






Dear phylo-sig list people,

I want to do ancestral state reconstruction
(preferably with ace) with
one (or more) of the internal nodes 'fixed' for a
range / a distribution
of values. For instance, I want a node leading to one
particular clade
that is present a subset of my trees to have a value
from 0.2-0.5, and
then do the ancestral state reconstruction with this
restriction on that
node.

I have been searching the archives and the net for
discussion of this
(but maybe with the wrong search terms), and I cannot
find anything
about it - not how to do it in R or in any other
package.

Thanks for your input!
Annemarie

--
Annemarie Verkerk, MA
Evolutionary Processes in Language and Culture (PhD
student)
Max Planck Institute for Psycholinguistics
P.O. Box 310, 6500AH Nijmegen, The Netherlands
+31 (0)24 3521 185
http://www.mpi.nl/research/research-projects/evolutionary-processes

___
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


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


Re: [R-sig-phylo] ancestral state reconstruction with fixed internal node(s)

2011-06-30 Thread Liam J. Revell

Hi Annemarie,

I do think this makes sense - *if* (and this may be a big if, 
depending on your data) we have a value for a hypothetical ancestor for 
which we are very confident and which we are sure belongs at a 
particularly ancestral node.


In that case, you could indeed use ace() by assigning attaching a zero 
length tip edge to the internal node of interest.


To illustrate this using an example, let's do the following:

# first generate a pure-birth tree using birthdeath.tree in geiger
tree-drop.tip(birthdeath.tree(b=1,d=0,taxa.stop=21),21)

# now plot the tree with internal node numbers
plot(tree); nodelabels(length(tree$tip)+1:tree$Nnode)

# now let's simulate on the tree using fastBM() from my phytools package
# (not on CRAN, but http://anolis.oeb.harvard.edu/~liam/R-phylogenetics)
# in this case we know the ancestral states if we set internal=TRUE
x-fastBM(tree,internal=T)
y-x[1:length(tree$tip)] # only the tip states

# now, let's say we want to attach the tip to node 22 in this case
tip-list(edge=matrix(c(2L,1L),1,2),tip.label=22,edge.length=0,Nnode=1L)
class(tip)-phylo
atree-multi2di(bind.tree(tree,tip,where=22))
z-c(y,x[22])

# now let's estimate ancestral states - we can do this using
# method=gls
res.gls-ace(z,atree,method=GLS,corStruct=corBrownian(1,atree))

Keep in mind that the node numbers in tree and atree are different 
(because the latter has a different number of tips) *and* we have a 
different number of them (because we used multi2di() to fully resolve 
our multifurcating tree after we attached the extra tip).


Hope this helps.

- Liam

--
Liam J. Revell
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://phytools.blogspot.com

On 6/30/2011 12:40 PM, ppi...@uniroma3.it wrote:

Hi AnneMarie,
I dont really know if this makes sense; in fact
ancestral state reconstruction is an ** a posteriori
estimation ** of nodal values starting from tips
observations.

A trick could be to add a false taxon lnked to that
node  and giving to it a 0 branch length (i.e.
plitomized - you can then resolve this during
computation using multi2di() ) and assigning your
desired trait value.

I'm not sure if this helps

Best
Paolo






Dear phylo-sig list people,

I want to do ancestral state reconstruction
(preferably with ace) with
one (or more) of the internal nodes 'fixed' for a
range / a distribution
of values. For instance, I want a node leading to one
particular clade
that is present a subset of my trees to have a value
from 0.2-0.5, and
then do the ancestral state reconstruction with this
restriction on that
node.

I have been searching the archives and the net for
discussion of this
(but maybe with the wrong search terms), and I cannot
find anything
about it - not how to do it in R or in any other
package.

Thanks for your input!
Annemarie

--
Annemarie Verkerk, MA
Evolutionary Processes in Language and Culture (PhD
student)
Max Planck Institute for Psycholinguistics
P.O. Box 310, 6500AH Nijmegen, The Netherlands
+31 (0)24 3521 185
http://www.mpi.nl/research/research-projects/evolutionary-processes

___
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


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


Re: [R-sig-phylo] ancestral state reconstruction with fixed internal node(s)

2011-06-30 Thread Theodore Garland Jr
Hi Graham,

I, too, have done this under Brownian motion and squared-change parsimony 
reconstructions.
In my experience (which was a while ago, and memory fades ...), the confidence 
intervals for nodes near to the one you constrain (near in terms of the 
length of the branches connecting the nodes) should be reduced, and sometimes 
substantially, if the constrained node is close by.  Right? 

Cheers,
Ted

Theodore Garland, Jr.
Professor
Department of Biology
University of California, Riverside
Riverside, CA 92521
Office Phone:  (951) 827-3524
Wet Lab Phone:  (951) 827-5724
Dry Lab Phone:  (951) 827-4026
Home Phone:  (951) 328-0820
Facsimile:  (951) 827-4286 = Dept. office (not confidential)
Email:  tgarl...@ucr.edu
http://www.biology.ucr.edu/people/faculty/Garland.html

Experimental Evolution: Concepts, Methods, and Applications of Selection 
Experiments
Edited by Theodore Garland, Jr. and Michael R. Rose
http://www.ucpress.edu/book.php?isbn=9780520261808
(PDFs of chapters are available from me or from the individual authors)


From: r-sig-phylo-boun...@r-project.org [r-sig-phylo-boun...@r-project.org] on 
behalf of Graham Slater [gsla...@ucla.edu]
Sent: Thursday, June 30, 2011 10:09 AM
To: r-sig-phylo@r-project.org
Subject: Re: [R-sig-phylo] ancestral state reconstruction with fixed internal 
node(s)

Hi AnneMarie,

The way Paolo suggests would be the best/right way to do this. We're
working on some methods for incorporating fossil info in comparative
methods and I have some code that will do this that i can send you
off-list if you would like. I should add that, at least based on what
we've found so far, doing this probably won't make much difference to
your reconstructed ancestral states, simply because under BM, your CIs
are so wide without constraining nodes that doing so has little effect.

best,

Graham

On 06/30/2011 09:40 AM, ppi...@uniroma3.it wrote:
 Hi AnneMarie,
 I dont really know if this makes sense; in fact
 ancestral state reconstruction is an ** a posteriori
 estimation ** of nodal values starting from tips
 observations.

 A trick could be to add a false taxon lnked to that
 node  and giving to it a 0 branch length (i.e.
 plitomized - you can then resolve this during
 computation using multi2di() ) and assigning your
 desired trait value.

 I'm not sure if this helps

 Best
 Paolo






 Dear phylo-sig list people,

 I want to do ancestral state reconstruction
 (preferably with ace) with
 one (or more) of the internal nodes 'fixed' for a
 range / a distribution
 of values. For instance, I want a node leading to one
 particular clade
 that is present a subset of my trees to have a value
 from 0.2-0.5, and
 then do the ancestral state reconstruction with this
 restriction on that
 node.

 I have been searching the archives and the net for
 discussion of this
 (but maybe with the wrong search terms), and I cannot
 find anything
 about it - not how to do it in R or in any other
 package.

 Thanks for your input!
 Annemarie

 --
 Annemarie Verkerk, MA
 Evolutionary Processes in Language and Culture (PhD
 student)
 Max Planck Institute for Psycholinguistics
 P.O. Box 310, 6500AH Nijmegen, The Netherlands
 +31 (0)24 3521 185
 http://www.mpi.nl/research/research-projects/evolutionary-processes

 ___
 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

___
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