---UPDATE: I am now using code formatting from gist.github, so I replaced the old prettyR code (sorry guys). The github way is much easier and prettier. I hope readers like the change.
I wrote earlier about some code I wrote for running Phylometa (software to do phylogenetic meta-analysis) from R.
I have been concerned about what exactly is the right penalty for including phylogeny in a meta-analysis. E.g.: AIC is calculated from Q in Phylometa, and Q increases with tree size.
So, I wrote some code to shuffle the tips of your tree N number of times, run Phylometa, and extract just the "Phylogenetic MA" part of the output. So, we compare the observed output (without tip shuffling) to the distribution of the tip shuffled output, and we can calculate a P-value from that. The code I wrote simply extracts the pooled effect size for fixed and also random-effects models. But you could change the code to extract whatever you like for the randomization.
I think the point of this code is not to estimate your pooled effects, etc., but may be an alternative way to compare traditional to phylogenetic MA where hopefully simply incorporating a tree is not penalizing the meta-analysis so much that you will always accept the traditional MA as better.
Get the code here, and also below. Get the example tree file and data file, named "phylogeny.txt" and "metadata_2g.txt", respectively below (or use your own data!). You need the file "phylometa_fxn.r" from my website, get here, but just call it using source as seen below.
As you can see, the observed values fall well within the distribution of values obtained from shuffling tips. P-values were 0.64 and 0.68 for fixed- and random-effects MA's, respectively. This suggests, to me at least, that the traditional (distribution of tip shuffled analyses, the histograms below) and phylogenetic (red lines) MA's are not different. The way I would use this is as an additional analysis to the actual Phylometa output.
Recology HAS MOVED TO http://recology.info/. To get to the same blog post on the new site replace the http://r-ecology.blogspot.ca/ with http://recology.info/, but with the same ending, e,g. /2011/12/weecology-can-has-new-mammal-dataset.html (except remove the .html at the end)
Showing posts with label meta-analysis. Show all posts
Showing posts with label meta-analysis. Show all posts
Saturday, April 16, 2011
Friday, April 1, 2011
Phylometa from R - UDPATE
THIS BLOG HAS MOVED: New version of this post at http://recology.info/2011/04/phylometa-from-r-udpate/
A while back I posted some messy code to run Phylometa from R, especially useful for processing the output data from Phylometa which is not easily done. The code is still quite messy, but it should work now. I have run the code with tens of different data sets and phylogenies so it should work.
A while back I posted some messy code to run Phylometa from R, especially useful for processing the output data from Phylometa which is not easily done. The code is still quite messy, but it should work now. I have run the code with tens of different data sets and phylogenies so it should work.
I fixed errors when parentheses came up against numbers in the output, and other things. You can use the code for up to 4 levels of your grouping variable. In addition, there are some lines of code to plot the effect sizes with confidence intervals, comparing random and fixed effects models and phylogenetic and traditional models.
Get the code at my website:
- Use the first file to do the work, calling the second file using source().
- This new code works with Marc's new version of Phylometa, so please update: http://lajeunesse.myweb.usf.edu/publications.html
- This new code works with Marc's new version of Phylometa, so please update: http://lajeunesse.myweb.usf.edu/publications.html
Again, please let me know if it doesn't work, if it's worthless, what changes could make it better.
Some notes on tree formatting for Phylometa.
1. Trees cannot have node labels - remove them (e.g., tree$node.label < NULL).
2. Trees cannot have zero length branches. This may seem like a non-problem, but it might be for example if you have resolved polytomies and zero length branches are added to resolve the polytomy.
3. I think you cannot have a branch length on the root branch.
Some notes on tree formatting for Phylometa.
1. Trees cannot have node labels - remove them (e.g., tree$node.label < NULL).
2. Trees cannot have zero length branches. This may seem like a non-problem, but it might be for example if you have resolved polytomies and zero length branches are added to resolve the polytomy.
3. I think you cannot have a branch length on the root branch.
Subscribe to:
Posts (Atom)
