Hi Liam, Many thanks! In the end I did it using rayDISC, if one uses rayDISC(phy,x,ntraits=1,charnum=1,model="ER",node.states="marginal",root.p=c(1-mean(x[,2]),mean(x[,2]))) you take a root prior equal to the tip frequencies, whereas rayDISC(phy,x2,ntraits=1,charnum=1,model="ER",node.states="marginal",root.p=c(0.5,0.5)) would reflect a flat prior.
Using these different root priors indeed changed results quite drastically, given the highly unequal distribution of the trait. With a flat root prior, the reconstruction for the root was something like 0.7, whereas with the tip frequencies root prior, the root reconstruction was 0.99. Of course, using a root prior reflecting the tip frequencies may not be quite right, but then again using a flat prior when you have a highly unequal trait distribution also seems a bit silly... So still not sure what is the best root to take in these cases... Cheers, Tom -----Original Message----- From: Liam J. Revell [mailto:liam.rev...@umb.edu] Sent: 14 September 2013 21:14 To: Tom Wenseleers Subject: Re: [R-sig-phylo] Question on ace ML reconstruction of discrete binary character Tom. I'm not sure if this was addressed. corHMM should be doing ancestral state correctly, so if you can specify a prior distribution on the root this should be fine. make.simmap in the phytools package also allows user control over the prior for the root (parameter pi). rerootingMethod assumes a flat prior. All the best, - Liam Liam J. Revell, Assistant Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 7/30/2013 3:27 AM, Tom Wenseleers wrote: > Dear Liam, > Many thanks for your message and the clarification - that was indeed not > clear to me from the ace help page! > Would ancRECON in package corHMM also be OK by any chance for my purposes? I > see that that one also allows one to specify the prior for the root and I am > dealing with binary characters with symmetric transition rates... > > Cheers & thanks again for the advice! > Tom > > -----Original Message----- > From: Liam J. Revell [mailto:liam.rev...@umb.edu] > Sent: 30 July 2013 05:31 > To: Tom Wenseleers > Cc: r-sig-phylo@r-project.org > Subject: Re: [R-sig-phylo] Question on ace ML reconstruction of > discrete binary character > > Hi Tom. > > This was the subject of discussion recently on this list. ace does not > do marginal ancestral state reconstruction (which is probably what you > want) - it computes the conditional scaled likelihoods of the subtree. > These are the same as the marginal reconstructions only at the root node. If > your transition matrix is symmetric, then you can get the marginal > reconstructions by rerooting at all the internal nodes. This is in the > phytools function rerootingMethod > (http://www.phytools.org/static.help/rerootingMethod.html). If you want to > use a more complicated model, you will have to use another package - such as > diversitree. > > An alternative is to use stochastic mapping and then compute the posterior > frequencies from the sample of stochastic maps. This makes it easy to put an > explicit prior on the root and to integrate over uncertainty in the > transition matrix. This is implemented in phytools also > (http://www.phytools.org/static.help/make.simmap.html). > > All the best, Liam > > Liam J. Revell, Assistant Professor of Biology University of > Massachusetts Boston > web: http://faculty.umb.edu/liam.revell/ > email: liam.rev...@umb.edu > blog: http://blog.phytools.org > > On 7/29/2013 5:45 PM, Tom Wenseleers wrote: >> Dear all, >> >> @Arne: yes I think it has to do something with the priors for the root. >> I'm not sure what prior ace uses - I think equal, which in my case >> would not be so appropriate given that nearly all species have the >> trait.Would anyone know by any chance whether in ape it is possible >> to haveace use a prior for the root which would reflect the frequency >> at the tips, and if so, how one could specify this? >> >> Cheers, >> >> Tom >> >> *From:*Arne Mooers [mailto:amoo...@sfu.ca] >> *Sent:* 29 July 2013 20:10 >> *To:* Tom Wenseleers >> *Subject:* Question on ace ML reconstruction of discrete binary >> character >> >> Hoi Tom, >> >> What is the default prior on the root in ace? Different approaches >> use different priors (=observed frequency at tips, equal, equal to >> tested ratio of q's, etc.) That has had a big affect on >> reconstructions I have done in the past. >> >> Cheers, >> >> Arne Mooers >> >> Begin forwarded message: >> >> *From: *Tom Wenseleers <tom.wensele...@bio.kuleuven.be >> <mailto:tom.wensele...@bio.kuleuven.be>> >> >> *Date: *29 July, 2013 9:00:28 AM PDT >> >> *To: *"r-sig-phylo@r-project.org <mailto:r-sig-phylo@r-project.org>" >> <r-sig-phylo@r-project.org <mailto:r-sig-phylo@r-project.org>> >> >> *Subject: [R-sig-phylo] Question on ace ML reconstruction of discrete >> binary character* >> >> Dear all, >> >> I just did some ancestral state reconstructions of binary characters >> (screenshot attached) using ace (using an equal rate discrete >> character >> reconstruction) . Everything seems to make sense to me, except the >> two basal nodes, where I end up with quite low likelihoods for my red >> character being 1 (cf. the pie charts), even though I get higher >> likelihoods at practically all of the more shallow nodes in the tree. >> Any ideas why one can get a result like this, and what I could >> potentially do about it, since it doesn't seem quite right to me? >> >> Cheers, >> >> Tom >> >> /____________________________________________________________________ >> _ >> __________________/ >> >> /Prof. Tom Wenseleers/ >> >> */ Lab. of Socioecology and Social Evolution/ >> >> / Dept. of Biology/ >> >> / Zoological Institute/ >> >> / K.U.Leuven/ >> >> ///Naamsestraat 59, box 2466/ >> >> / B-3000 Leuven/ >> >> / Belgium >> /(/+32 (0)16 32 39 64 / +32 (0)472 40 45 96/ >> >> 8/tom.wensele...@bio.kuleuven.be >> <mailto:tom.wensele...@bio.kuleuven.be>/ >> >> */http://bio.kuleuven.be/ento/wenseleers/twenseleers.htm/* >> >> _______________________________________________ >> R-sig-phylo mailing list -R-sig-phylo@r-project.org >> <mailto:R-sig-phylo@r-project.org> >> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo >> Searchable archive >> athttp://www.mail-archive.com/r-sig-phylo@r-project.org/ >> >> _____________________________ >> Dr. Arne Mooers >> Biology, Simon Fraser University >> 8888 University Drive., Burnaby BC V5A 1S6 Canada amoo...@sfu.ca >> <mailto:amoo...@sfu.ca> >> +1 778 782 3979 >> skype: arnemooers >> www.sfu.ca/~amooers <http://www.sfu.ca/~amooers> www.sfu.ca/fabstar >> <http://www.sfu.ca/fabstar> www.scientists-4-species.org >> <http://www.scientists-4-species.org> >> hesp.irmacs.sfu.ca >> 7billionandyou.org >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> R-sig-phylo mailing list - 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 mailing list - 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/