A faster way to calculate MESS in R – or – a tribute to Stack overflow

Jean-Pierre Rossi introduced a function to calculate the “Multivariate Environmental Similarity Surfaces” in R. Since then, the function has become part of the dismo package, which is a package maintained by Robert J. Hijmans and which offers a whole lot of functions for species distribution modelling.

The function calculates the MESS based on a point layer (the reference points) and a set of raster layers (the environmental data layers). It works great for smaller data sets, but you may run into trouble for very large data sets. So I needed to find a way to run this faster. And… I couldn’t. It is already a pretty neat piece of code, and I could not think of a better way of doing this in R. (I am working on For an alternative to do this in GRASS, but more about that later: see here).

That is where I decided to try my luck on Stack Overflow. Continue reading “A faster way to calculate MESS in R – or – a tribute to Stack overflow”

A short note on the use of predict with the dismo or raster package

R has some great packages for species distribution modelling. One of these packages is the dismo package.

Models objects created with one of the various distribution models available in dismo can be used to make prediction for any combination of values of the independent variables. To do this, you use the ‘predict‘ function. The predict function requires a model object and a RasterStack or dataframe with the independent variables.

So, what will be faster, a RasterStack or dataframe as input in the predict function? Continue reading “A short note on the use of predict with the dismo or raster package”

R/GRASS connection: more than the sum of its parts

GRASS GIS is a very powerfull GIS offering an extensive set of tools for geospatial data management and analysis, image processing, and spatial modeling. The possibility to directly interact with R further improves the geospatial analysis capabilities of GRASS (see R Spatial View). Continue reading “R/GRASS connection: more than the sum of its parts”

Calculating bioclim variables in GRASS GIS

I am currently working on the modeling of the distribution of different vegetation types and associate species in eastern Africa. In absence of more detailed climate data for the region, a great source of global climatic data is the WorldClim website. Besides the usual monthly temperature and rainfall data, it provides bioclimatic variables which are derived from these monthly temperature and rainfall values in order to generate more biologically meaningful variables. However, it only does this for the current conditions (interpolations of observed data, representative of 1950-2000) but not yet (?) for the future conditions (downscaled data from global climate model (GCM) output, IPPC 3rd assessment). Thus, I had to calculate them myself, which I did using GRASS GIS and R. Continue reading “Calculating bioclim variables in GRASS GIS”