Summer of Maps: Bike Thefts Over Time: Breaking the Cycle

Summer of Maps: Bike Thefts Over Time: Breaking the Cycle

Now in its second year, Azavea’s Summer of Maps Program has become an important resource for non-profits and student GIS analysts alike.  Non-profits receive pro bono spatial analysis work that can enhance their business decision-making processes and programmatic activities, while students benefit from Azavea mentors’ experience and expertise.   This year, three fellows worked on projects for six organizations that spanned a variety of topics and geographic regions.  This blog series documents some of their accomplishments and challenges during their fellowship.  Our 2013 sponsors, Esri and Tri-Co Digital Humanities helped make this program possible.  For more information about the program, please fill out the form on the Summer of Maps page.

 

Bike Thefts Over Time: Breaking the Cycle

Introduction:

Early in my Summer of Maps Fellowship I was able to watch Jeremy Heffner, Josh Marcus, and Rob Emanuele give a presentation about the latest version of Azavea’s crime prediction software, Hunchlab. I was struck by how similar Hunchlab’s prediction and time-series analyses were to environmental applications I had learned as a graduate student at Clark University. They specifically pointed out Hunchlab’s ability to remove seasonality to examine underlying trends in point-based crime data, something I had done before but with remotely-sensed raster data in IDRISI. I was especially interested in time series analysis considering my investigation of 10,747 bike thefts reported from 2007 through 2012 for the Bicycle Coalition of Greater Philadelphia.

Due to the way that reported bicycle thefts are recorded by the Philadelphia Police Department, every record has both a latitude and longitude, as well as a date and time. I was able to visualize bike thefts as a time series animation using ArcMap’s Tracking Analyst extension, which clearly showed a strong cyclical trend that peaked in the late summer months and bottomed out in the winter months:

The problem with strong seasonal or cyclical change is that the large trend can mask small-scale trends. For instance, vegetation abundance declines in the winter and increases through the summer, but the effect of heat waves and cold spells are hidden within the large-scale seasonal variation. This is why the process to remove cyclical trends or seasonality is sometimes called deseasoning.

Deseasoning, de-cycling, or seasonal decomposition is a complex operation that can’t be found in ArcMap but is available in remote sensing software and a free, open source software package called R. R has a wide array of “packages” that can extend its functionality, and the “zoo” package enables time series analysis.

Prior to deseasoning, I aggregated the individual thefts into the 60 months that comprised January 2007 to December 2012. I then followed R’s loading process (which can be finicky) and converted the data into a time series. Finally, I used R’s zoo package to run a seasonal decomposition on the time series and plotted the results:

The plot shows the observed amount of monthly bicycle thefts on top, and the third row shows the computed cyclical or seasonal component that was removed from the observed values. The second row shows what the trend over time looks like with the seasonality removed, and the bottom row is a measure of the variability.

Removing seasonality reveals an increasing trend in bike thefts from 2007 to the end of 2012. The spikes in the trend in later years are probably due to increases in theft as a result of the unseasonably warm winters of 2010/11 and 2011/12. Time-series analysis and seasonal decomposition proved to be very useful tools to help characterize the trend of bike theft in Philadelphia, which was almost entirely masked by the large seasonal spikes. My work on this project, as well as my introduction to Hunchlab, helped me realize that statistical operations that I initially thought were useful for only one field (the environment) are actually practical for a wide range of subjects.

Sources:

Time Series Analysis background: http://www.statsoft.com/textbook/time-series-analysis/#ggeneral

Season Trend Decomposition instructions: http://www.r-bloggers.com/seasonal-trend-decomposition-in-r/