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

Tuesday, April 28, 2015

Mosaic Rasters to a Seamless Raster


Step 1 Create Mosaic Raster from rasters

This actually can be further divided into two steps: 1) create a mosaic raster dataset; 2) add rasters to mosaic raster dataset. A lot of details should be noticed when working on these two seemingly straightforward steps. The following links redirect you to webpages that are showing how to perform the operations step by step ( if you have any problems, feel free to leave comments on this post):

http://resources.arcgis.com/en/help/main/10.1/index.html#/Creating_a_mosaic_dataset_containing_raster_data_from_multiple_dates/009t000000v1000000/

http://gishelper.com/resources/USING%20A%20MOSAIC%20DATASET%20TO%20ADD%20A%20HILLSHADE%20TO%20A%20SCANNED%20MAP.pdf

Possible problems that you would come across during your operation can be solved:

http://blogs.esri.com/esri/supportcenter/2011/10/07/imagery-not-displaying-in-your-mosaic-dataset/


Step 2 Create seamless Mosaic Raster

https://www.youtube.com/watch?v=qJHCbEVbMv0

For latest version of ArcGIS for DESKTOP, code as follows works well:
Con(IsNull("myraster"), FocalStatistics("myraster", NbrRectangle(2,2, "CELL"), "MEAN"), "myraster")

Sunday, April 19, 2015

Reasons to use meta-analysis

http://theincidentaleconomist.com/wordpress/theres-a-reason-i-use-systematic-reviews-and-meta-analyses/

Thursday, March 26, 2015

More ways to get Landsat Data

http://landsat.gsfc.nasa.gov/?p=10221

Mar 26, 2015 • Last Thursday, Amazon Web Services (AWS) announced that it is now hosting Landsat 8 imagery on its publicly accessible Simple Storage Service (S3). With help from the White House Office of Science and Technology Policy and the U.S. Geological Survey—manager of the vast Landsat archive—AWS has made over 80,000 Landsat 8 scenes (~85 Tb worth of data) available as one of its AWS Pubic Data Sets, and hundreds of Landsat 8 scenes are being added daily—as they are collected, they are added. Each spectral band of each Landsat scene is available as a stand-alone GeoTIFF.
AWS also plans to add historic data from Landsats 1, 2, 3, 4, 5, and 7. The AWS Public Data Sets infrastructure is a “centralized repository of selected public data sets that can be integrated into AWS cloud-based applications to reduce the time and cost associated with transferring large data sets.”
Jed Sundwall, writing for the Amazon Web Services Official Blog, stated “As we said in December, we hope to accelerate innovation in climate research, humanitarian relief, and disaster preparedness efforts around the world by making Landsat data readily available near our flexible computing resources. We have committed to host up to a petabyte of Landsat data as a contribution to the White House’s Climate Data Initiative. Because the imagery is available on AWS, researchers and software developers can use any of our on-demand services to perform analysis and create new products without needing to worry about storage or bandwidth costs.”
In 2013, AWS teamed together with NASA’s Earth Exchange and USGS to offer the Landsat Global Land Survey data set (s3://nasanex/Landsat). This data set included mostly cloud free Landsat images covering the globe for four distinct time periods: the mid-1970s, and circa 1990, 2000, and 2005. The new Landsat on AWS public data set will offer all Landsat 8 data and eventually all Landsat data (up to 1 Pb).
In 2010, Google Earth Engine announced that it would host Landsat 30 m data (from 1984–2012). At that time the then-USGS Director, Marcia McNutt, wrote: “Landsat has become, over the years, a vital reference worldwide for understanding scientific issues related to land use and natural resources. With its long term historical record of the entire globe and widely recognized high quality of data, Landsat is valued all over the world as the “gold standard” of land observation.”
This past December, Secretary of the Interior, Sally Jewell, speaking of the Climate Data Initiative’s goal to share data including Landsat, said “By unleashing the power of our vast and open data resources, the Climate Data Initiative helps spark private sector innovation and will leverage resources for those on the front lines who are dealing with climate change. We are pooling into one place data from across the federal government to make it more accessible to the public and we hope our efforts will inspire other countries to follow suit.”