[R-sig-phylo] fitContinuous in geiger: positive log-likelihoods when trait values 1
Hi all, It seems to be a popular week for questions! I am running fitContinuous on a variety of continuous trait data. I am noticing that when the traits are in units where the max is less than 1 (these are not ratio data, though), many of the various models produce log-likelihoods that are positive, which ought to be impossible. If I rescale the trait values, e.g. by multiplying them by 100, the problem goes away and all log-likelihoods are negative, and come out somewhat similar to each other between the BM, OU, etc. models, as one would expect. Any hint about why this might be? Cheers, Nick -- Nicholas J. Matzke Ph.D. Candidate, Graduate Student Researcher Huelsenbeck Lab Center for Theoretical Evolutionary Genomics 4151 VLSB (Valley Life Sciences Building) Department of Integrative Biology University of California, Berkeley Graduate Student Instructor, IB200B Principles of Phylogenetics: Ecology and Evolution http://ib.berkeley.edu/courses/ib200b/ http://phylo.wikidot.com/ Lab websites: http://ib.berkeley.edu/people/lab_detail.php?lab=54 http://fisher.berkeley.edu/cteg/hlab.html Dept. personal page: http://ib.berkeley.edu/people/students/person_detail.php?person=370 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html Lab phone: 510-643-6299 Dept. fax: 510-643-6264 Cell phone: 510-301-0179 Email: mat...@berkeley.edu Mailing address: Department of Integrative Biology 3060 VLSB #3140 Berkeley, CA 94720-3140 - [W]hen people thought the earth was flat, they were wrong. When people thought the earth was spherical, they were wrong. But if you think that thinking the earth is spherical is just as wrong as thinking the earth is flat, then your view is wronger than both of them put together. Isaac Asimov (1989). The Relativity of Wrong. The Skeptical Inquirer, 14(1), 35-44. Fall 1989. http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] fitContinuous in geiger: positive log-likelihoods when trait values 1
Doh! Really should have remembered that, likelihoods-can-be-greater-than-1 is likelihood 101... I am still a little puzzled by the dramatically different results between rescaling and not, will try to post an example in a sec... On 3/7/11 12:37 PM, Nick Matzke wrote: Hi all, It seems to be a popular week for questions! I am running fitContinuous on a variety of continuous trait data. I am noticing that when the traits are in units where the max is less than 1 (these are not ratio data, though), many of the various models produce log-likelihoods that are positive, which ought to be impossible. If I rescale the trait values, e.g. by multiplying them by 100, the problem goes away and all log-likelihoods are negative, and come out somewhat similar to each other between the BM, OU, etc. models, as one would expect. Any hint about why this might be? Cheers, Nick -- Nicholas J. Matzke Ph.D. Candidate, Graduate Student Researcher Huelsenbeck Lab Center for Theoretical Evolutionary Genomics 4151 VLSB (Valley Life Sciences Building) Department of Integrative Biology University of California, Berkeley Graduate Student Instructor, IB200B Principles of Phylogenetics: Ecology and Evolution http://ib.berkeley.edu/courses/ib200b/ http://phylo.wikidot.com/ Lab websites: http://ib.berkeley.edu/people/lab_detail.php?lab=54 http://fisher.berkeley.edu/cteg/hlab.html Dept. personal page: http://ib.berkeley.edu/people/students/person_detail.php?person=370 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html Lab phone: 510-643-6299 Dept. fax: 510-643-6264 Cell phone: 510-301-0179 Email: mat...@berkeley.edu Mailing address: Department of Integrative Biology 3060 VLSB #3140 Berkeley, CA 94720-3140 - [W]hen people thought the earth was flat, they were wrong. When people thought the earth was spherical, they were wrong. But if you think that thinking the earth is spherical is just as wrong as thinking the earth is flat, then your view is wronger than both of them put together. Isaac Asimov (1989). The Relativity of Wrong. The Skeptical Inquirer, 14(1), 35-44. Fall 1989. http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] fitContinuous in geiger: positive log-likelihoods when trait values 1
Hi Nick- Are you are getting differences in relative AICs between models from simple rescaling (multiplying by a constant)? The actual values of the traits *might* matter for optimization, depending on various parameters associated with optimization (and whatever algorithm is being used - this should be L-BFGS-B for fitContinuous, I think). So...if relative AICs are different, the first thing I would check is whether some of your model AICs reflect local optima. Do lots of optimizations with random starting parameters, which is usually sufficient - and failing that, you can get into the guts of optim and mess with the actual arguments that control the optimization (e.g., parscale etc). FYI, this is not immediately transparent in Geiger, as many of the functions are hidden. To get at the optimization, look at geiger:::fitContinuousModel which does the heavy lifting within fitContinuous, and if you need to, you can recode the relevant call to optim to have a bit more flexibility. ~Dan On Mar 7, 2011, at 4:04 PM, Nick Matzke wrote: Doh! Really should have remembered that, likelihoods-can-be-greater-than-1 is likelihood 101... I am still a little puzzled by the dramatically different results between rescaling and not, will try to post an example in a sec... [[alternative HTML version deleted]] ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] fitContinuous in geiger: positive log-likelihoods when trait values 1
Ah, so while re-creating my problem for copy-paste-debug goodness on the listserv, I discovered what was confusing me. Originally, when I ran the various models, I got these log-likelihoods for results: == tf2ic2kzkr turn BM -9.923018 -9.725328 -9.740485 -44.67030 OU 17.939356 61.492326 43.530827 -42.22548 lambda -9.923018 -9.725328 -9.740485 -42.26222 kappa -9.923018 -9.725328 -9.740485 -44.45598 delta 18.121709 61.731899 42.452448 -43.09885 EB 9.649302 11.810710 11.612804 -44.67030 white 17.224360 58.832699 43.138356 -42.26222 == The trait data is roughly normal, the phylogeny is pretty standard, so it was damned odd and rather hard to see why OU and white noise (!) would be dozens of log-likelihood units higher than Brownian motion, for instance. turn trait data were all above 1, but for tf2ic2, kz, and kr, they were below 1. So I was suspecting a bug or something. As it turns out, back when first experimenting with fitContinuous, I had input non-default bounds on the models, and then forgot about it. I think I probably ruled some of the optimal parameter values out-of-bounds for the trait data 1, and this gave pathological results. Going back to defaults, we get: tf2ic2 kz kr turn BM 17.46596 60.96182 40.75615 -44.67030 OU 17.93936 61.49233 43.53083 -42.22548 lambda 17.46596 60.96182 43.13836 -42.26235 kappa 17.46596 60.96182 41.43779 -44.45598 delta 18.12171 61.73190 42.45245 -43.09885 EB 17.46596 60.96182 40.75615 -44.67030 white 17.22436 58.83270 43.13836 -42.26222 ...which seems far more reasonable... Multiplying the trait data by 100 actually doesn't appear to change the subsequent log-likelihoods in this case, in the situation where the bounds are defaults rather than my screwed-up bounds... tf2ic2 kz kr turn BM 17.46596 60.96182 40.75615 -44.67030 OU 17.93936 61.49233 43.53083 -42.22548 lambda 17.46596 60.96182 43.13836 -42.26235 kappa 17.46596 60.96182 41.43779 -44.45598 delta 18.12171 61.73190 42.45245 -43.09885 EB 17.46596 60.96182 40.75615 -44.67030 white 17.22436 58.83270 43.13836 -42.26222 ...which is also encouraging. So, basically, thanks for the help and sorry for the trouble! Nick On 3/7/11 4:41 PM, Dan Rabosky wrote: Hi Nick- Are you are getting differences in relative AICs between models from simple rescaling (multiplying by a constant)? The actual values of the traits *might* matter for optimization, depending on various parameters associated with optimization (and whatever algorithm is being used - this should be L-BFGS-B for fitContinuous, I think). So...if relative AICs are different, the first thing I would check is whether some of your model AICs reflect local optima. Do lots of optimizations with random starting parameters, which is usually sufficient - and failing that, you can get into the guts of optim and mess with the actual arguments that control the optimization (e.g., parscale etc). FYI, this is not immediately transparent in Geiger, as many of the functions are hidden. To get at the optimization, look at geiger:::fitContinuousModel which does the heavy lifting within fitContinuous, and if you need to, you can recode the relevant call to optim to have a bit more flexibility. ~Dan On Mar 7, 2011, at 4:04 PM, Nick Matzke wrote: Doh! Really should have remembered that, likelihoods-can-be-greater-than-1 is likelihood 101... I am still a little puzzled by the dramatically different results between rescaling and not, will try to post an example in a sec... -- Nicholas J. Matzke Ph.D. Candidate, Graduate Student Researcher Huelsenbeck Lab Center for Theoretical Evolutionary Genomics 4151 VLSB (Valley Life Sciences Building) Department of Integrative Biology University of California, Berkeley Graduate Student Instructor, IB200B Principles of Phylogenetics: Ecology and Evolution http://ib.berkeley.edu/courses/ib200b/ http://phylo.wikidot.com/ Lab websites: http://ib.berkeley.edu/people/lab_detail.php?lab=54 http://fisher.berkeley.edu/cteg/hlab.html Dept. personal page: http://ib.berkeley.edu/people/students/person_detail.php?person=370 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html Lab phone: 510-643-6299 Dept. fax: 510-643-6264 Cell phone: 510-301-0179 Email: mat...@berkeley.edu Mailing address: Department of Integrative Biology 3060 VLSB #3140 Berkeley, CA 94720-3140 - [W]hen people thought the earth was flat, they were wrong. When people thought the earth was spherical, they were wrong.