Come hear Megan O'Connor and Carl Dunham talk about some of their recent research using R.
We examined the role of density-independent and density-dependent processes in shaping the distribution of yellowtail flounder in the Northeast U.S. Shelf ecosystem. First, we used the gini index to examine density-dependent dynamics. Second, we develop a class of regression models that are capable of detecting the joint effects of spatially variable density-dependent and density-independent relationships. Third, we use the models to evaluate whether there are gender and ontogenetic differences in the response of distribution to density-independent and density-dependent factors.
All model building and analysis were done using R. We took an approach that resulted in a repeatable process, so we could focus on changing the methodology in the scripts without worrying about mechanics of processing the data. Code, data files and final plots (as PNG files) were checked into git (http://github.com) to ensure that changes could be tracked and audited.
In addition to standard data handling/cleaning/munging, we used a gridding approach to summarize the model results over the spatial field. Variables of interest were sumarized over fixed grid area to N (count), min, max, mean, sd and quantile values. Although we only ended up referring to means, we felt it was valuable to keep the other statistics as they were easy to calculate at the same time. While there were packages available for gridding, we chose to code the approach ourselves, to retain flexibility.
Plotting then involved standard basemap imaging, coastline, bathymetry and other contextual information (US/Canada maritime border and closed areas of the fishery). Model results were plotted in two ways. First, for each plot over season and age/sex, grayscale overall predicted values were laid down as reference. Over these, plots for each specific predicted value were generated using circles whose size reflected (linearly) the magnitude, with color indicating sign (blue for negative, red for positive).
Packages used for plotting include:
sp - standard spatial functions
maptools - for reading and manipulating shapefile-based data
PBSmapping - for mapping model output and spatial analysis