In addition to the ideas so far, there is also corHMM. https://rdrr.io/cran/corHMM/man/corHMM.html is the main help for this, but you can also use corHMM::ancRECON, corHMM:rayDISC, and corHMM:corDISC. corHMM::plotRECON can plot ancestral state reconstructions.
For tip uncertainty, you can do 0&1 if you don�t know if the tip is state 0 or 1, but that it is definitely not 2. You can also create models, so if you think the rates are 0 -> 01 <-> 1 <-> 2, you can fit that and then reconstruct states using that model. And of course the �HMM� is for hidden Markov models, so you can allow for rate heterogeneity over the tree. Some things to remember with ancestral state reconstruction in general: 1. Results are really uncertain. Yes, you get some measurement of uncertainty, but it�s an underestimate: is your topology perfect? Branch lengths? Rate estimates? All of those are typically not included in the uncertainty estimation (well, rate uncertainty would be in most Bayesian approaches). And �all models are wrong� [there may be a longer version of the quote�] � it could be that certain states are not possible until after the Cretaceous, etc. but if that�s not built into the model, it doesn�t know that. 2. There was a dispute in the field on handling tip uncertainty. corHMM / hisse follow Felsenstein�s advice (from his book): if you don�t know if a state is 2 or 3 at a tip, the probability of seeing a 2 or a 3 at the tip is 100% when calculating the likelihood (the probability of the data). Some software in this space assumes it is 50% (but I haven�t checked in a few years, maybe it�s been updated?). It�s not clear what the effect of this difference in practice is. 3. Remember Maddison (2007)<https://doi.org/10.1111/j.0014-3820.2006.tb00517.x>, on confounding asymmetries. Your ancestral state estimates can be wrong if you assume there�s no differential diversification processes and use character-only models, and they can be wrong if you assume there�s no differential trait evolution processes and use diversification-only models. So, you can use joint models like in hisse or diversitree, but those might need more data to fit well than you have. 4. Your tree has N tips. You are trying to estimate some number of rates, while also reconstructing N-1 ancestral states (more if you want to try to understand what�s happening within branches, like with stochastic character mapping). This is� bold, to say the least. It could be that the question could be answered by looking at the rates alone: what�s the wait time between events, what are the magnitude of rates, etc. 5. Also note Maddison & FitzJohn (2015)<https://doi.org/10.1093/sysbio/syu070>, which points to issues of inferring rates of correlation. Those rates are what are used for reconstructions� does the problem lead to problems in reconstruction? Best, Brian _________________________________________ Brian O�Meara He/Him Professor, Dept. of Ecology & Evolutionary Biology University of Tenneseee, Knoxville From: R-sig-phylo <r-sig-phylo-boun...@r-project.org> on behalf of roee maor <roeem...@gmail.com> Date: Monday, November 14, 2022 at 6:37 AM To: r-sig-phylo@r-project.org <r-sig-phylo@r-project.org> Subject: Re: [R-sig-phylo] ancestral state reconstruction with a complex discrete trait [You don't often get email from roeem...@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Hi Chris, I sent this message a few days ago but can't see any sign that it was received so trying again. Apologies if anyone ends up seeing both. To the question- in addition to the other (good) solutions given in this thread, both HiSSE (R package) and BayesTraits (stand alone software) can handle ASR of multi-level categorical traits. I have used BayesTraits with option "Multi" for ASRs of traits with 3 and 4 states. Can't remember any limitations on using it for traits that take a larger number of character states (but it was a while ago I admit). Using HiSSE, coding your response character should be fairly straightforward depending on the number of character states you're looking at. If you have a trait with 4 observed states as you mention, it seems to me that there is an implied assumption that transitions between "black" and "white" must go through either "gray" (mixed) or "black-and-white" (patched). In this case you can encode observed phenotypes as {00} ,{01}, {10}, {11} and disable transitions between any two states (e.g. between {01} and {10}) based on your biological model/hypotheses. The original HiSSE paper (Beaulieu & O'Meara 2016 Syst. Biol.) is very clear, there is a helpful online tutorial. Nakov, Beaulieu & Alverston (Evolution, 2019) was also useful to me. HTH, Roi [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=05%7C01%7Cbomeara%40utk.edu%7C2322e3a252a34c721c7f08dac6349837%7C515813d9717d45dd9eca9aa19c09d6f9%7C0%7C0%7C638040226457158589%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=V5M7P4IAt%2BVz1xuA3ukNQRnR0oRz7%2FbBfm2zZ7LaNFM%3D&reserved=0 Searchable archive at https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=05%7C01%7Cbomeara%40utk.edu%7C2322e3a252a34c721c7f08dac6349837%7C515813d9717d45dd9eca9aa19c09d6f9%7C0%7C0%7C638040226457158589%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HFUnZiKBw1s55EL4dSyZn%2Bii3tTj0wPwSn1z175knVw%3D&reserved=0 [[alternative HTML version deleted]]
_______________________________________________ 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/