Tuesday, June 30, 2015

ggplot2 - Easy way to mix multiple graphs on the same page


http://www.sthda.com/english/wiki/ggplot2-easy-way-to-mix-multiple-graphs-on-the-same-page-r-software-and-data-visualization


http://cran.r-project.org/web/packages/cowplot/vignettes/plot_grid.html

Saturday, June 27, 2015

Geocoding in R


http://www.r-bloggers.com/batch-geocoding-with-r-and-google-maps-2/

Saturday, June 13, 2015

Saturday, June 6, 2015

Meta-analysis in ECOLOGY with R

Note: this post originated from my 


0. Data retrieval  from published studies:

This is the starting point, which determines all the following steps. Hence, it is very important to construct a clear protocol of 'data acquisition'.



1.Calculate 'effect size' and 'sampling variances'

This is a detailed introduction to the 'escalc' function in "metafor" package.
http://www.inside-r.org/packages/cran/metafor/docs/escalc

2. Data assumptions and normality test

Prior to do the analysis, it is essential to examine the data to see whether it is normally distributed and there are publication biases. These can be conducted by plotting a normal QQ plot:

-http://www.metafor-project.org/doku.php/plots:normal_qq_plots?s[]=publication&s[]=bias
-http://finzi.psych.upenn.edu/library/metafor/html/qqnorm.rma.html

However, "funnel plot"(Light & Pillemer, 1984) can only be functional for publication bias test. The shape of funnel plot can indicate whether a publication bias exists. As suggested by Wang and Bushman (1998), one difficulty is to identifying the shape of the 'funnel' plot. This, however, can be resolved by statistical asymmetry test.

Trim and fill: http://onlinelibrary.wiley.com/doi/10.1111/j.0006341X.2000.00455.x/abstract;jsessionid=B0A2647FC60DC8FF84EE4B944FD4BDAC.f01t01

Paper by Wang and Bushman (1998;http://psycnet.apa.org/journals/met/3/1/46/) has a good discussion on the pros and cons of 'funnel plot' and normal quantile QQ plot to examine data.

2. Do the Metaanalysis
When doing a meta-analysis, we can fit the data to a random-effects model. We can use both functions of rma () and rma.mv(). But the function "rma.mv" is originally designed for multi-level meta-analysis (http://www.inside-r.org/packages/cran/metafor/docs/rma.mv). However, note that when using the rma.mv() function, random effects must be explicitly added to the model via the random argument. For a standard random-effects model, we need to add random effects for the trials, which can be done with:


StackExchange Q/A about non-linear regression:
http://stats.stackexchange.com/questions/122196/nonlinear-meta-regression

3. Results visualization with "forest plot" using ggplot2
http://www.r-bloggers.com/forest-plots-using-r-and-ggplot2-3/



Finallly, here is an detailed introduction in doing metaanlysis with an ecology example:
https://rpubs.com/dylanjcraven/metaforr