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

Liam J. Revell liam.revell at umb.edu
Thu Jun 30 19:33:37 CEST 2011

```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.revell at umb.edu
blog: http://phytools.blogspot.com

On 6/30/2011 12:40 PM, ppiras at 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
> 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.
>
> 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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>
> _______________________________________________
> R-sig-phylo mailing list
> R-sig-phylo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

```