Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Archive for November, 2016

Quantitative analysis of gorilla movement and R-Stat (part 2)

Posted by smathermather on November 23, 2016

In my previous post, I did a bit of setup on the who and what for analyzing gorilla data. Now let’s move into R-Stat a little bit, specifically installation and configuration.

For R, we’ll install whatever package is the correct one for your machine, and then also install R-Studio. This gives us a nice development environment for R.

Screen shot of R-Studio

We’re going to leverage a few packages in our work. The first is the “sp” package. This gives us “CLasses and Methods for Spatial Data” in R:


We’ll also “rgdal”. This package gives us “Bindings for the Geospatial Data Abstraction Library”. For our use case here, this allows us to read shapefiles, geotiffs, and other spatial data.


We’ll use “rmarkdown” also. This allows us to build a markdown file (think HTML but much simpler) that includes our code in code blocks, and can be compiled to a document whether a web page, pdf, etc.. This encourages us to write code and document it in one place, and ultimately will allow us to build some really great reporting functionality while getting our analysis work done.


Finally, we’ll need the adehabitatLT package for aiding in our analysis of animal movement and habitat use.


We can, of course install all this in one swell foop as follows:


Now we have all the building blocks we need to start analyzing our data. Stick around for part 3.

Posted in Gorillas, Karisoke, R | Tagged: , , , , | 2 Comments »

Quantitative analysis of gorilla movement and R-Stat

Posted by smathermather on November 21, 2016

At this point in my career, it is a rare request that intimidates me. Most requests are either solved, largely solved (and I know how to find the answer), or broadly improbably / excessively expensive.

XKCD cartoon demonstrating the difficulty of distinguishing difficult problems in computer science

This is a nice place to be. I have a bit of calmness with every request, a vision for how to execute, or the escape valve of saying, “That’s harder / more expensive than you think. Perhaps we should look at these alternatives.”

Recently, I got a request that was tougher — a theoretically possible project at the edge of my knowledge domain, a desire to deliver at any reasonable cost, and no clear sense of who to ask for help.

Specifically, how does one take volumes of gorilla tracking data, and make sense of the behaviors and intentions implicit in their movement? Many know the story of Dian Fossey, the primatologist who lived with the mountain gorillas in Rwanda. What many may not know, is her research continues in Rwanda at Karisoke Research Center (and has continued for 50 years), following the troops of gorillas in Rwanda, and the project has expanded quite a bit under auspices of the Dian Fossey Gorilla fund:

Map of Africa

Map of East Africa centered on Rwanda

Map of Rwanda

Zoomed in map of Rwanda centered near Karisoke

Image of Karisoke then and now

I have the privilege of being sponsored by the Cleveland Zoological Society to got to Karisoke, observe the research, and help where needed with GIS infrastructure development and geospatial analyses. I am excited beyond belief.

So, what’s the test here? I know how to do geospatial infrastructure. Ask me to improve infrastructure and I have a decade of experience chasing down these problems, trying out different technologies, developing new ones. I also know how to perform advanced analyses. I pride myself on my analytic skills, even as I’ve moved from analyst to programmer to manager, etc.. But, I’ve never done the more advanced quantitative analyses of movement necessary to deepen understanding beyond work already done at Karisoke. Lots of great minds have already been looking at the data for years and decades. The basic question in my mind — how can I meaningfully help?

Thanks to my colleague Dr. Patrick Lorch, I have some sources. Pat did his thesis work studying the movements and behavior of Mormon crickets in the western US, and his experience with quantitative analysis of movement is directly applicable.

First we looked to Peter Turchin’s Quantitative Analysis of Movement. Then we found the adehabitat R-Stat module.

In short, the next few blog posts will be about the apparently incomparably beautiful nation of Rwanda, mountain gorillas, R-Stat, and adehabitat. There will be PostGIS mixed in for good measure. Stay tuned.

Posted in Gorillas, Karisoke, R | Tagged: , , , , | 3 Comments »