Mass Shootings in America
Contributed by Paul Grech and Chris Neimeth. They took NYC Data Science Academy 12 week full time Data Science Bootcamp program between Sept 23 to Dec 18, 2015. The post was based on their second class project(due at 4th week of the program).
Project By: Paul Grech & Chris Neimeth
Understanding Mass Shootings in America
Few topics are as emotionally charged as gun control. The horror of mass shootings seems to ring in our ears as an everyday occurrence; America has 5% of the world’s population, yet 31% of its mass shooters. Sadly, resolution of mass shootings and alignment on gun control is at a partisan deadlock. Discussions are emotionally charged and avoid facts. To encourage people to find common ground between civil liberty and the social contract we developed an application to explore relevant data. We hoped to create meaningful dialogue by including links to national gun control forums as well.
Data was pulled from two separate sources and merged depending on the analysis.
The first dataset is from Stanford University and is a collection of 218 events between 1966 and 2015. This data was collected by faculty and staff along with students beginning in 2012.
The second dataset is crowd-sourced Mass Shooting Tracker data. This dataset initially began at the beginning of 2014 on Reddit. It consists of 995 events between the start of 2013 to present.
Merging the two datasets was somewhat challenging given their different reporting techniques and definitions of mass shooting.
Data Import & Preprocessing
Data munging was relatively straightforward. As the code below shows, the data was imported, cleaned and labeled to standardize various features used in the layout of the application.
The Application Overview
The app uses a web application framework for the R programming language called Shiny which has two components know as the user-interface and server. The ui.r file is responsible for the layout of each tab while the server.r file is responsible for the content. All ui.r and server.r code can be found in the following github repository here.
The application itself consists of five tabs each aimed at allowing the user to explore a different aspect of each event.
Geo Coding and Mapping
(Note, there is a 2,500 call/day limit for non-paid use of this service.)
Shooter, Weapon and Victim Data
The three main components within a mass shooting discussion include the shooter profile, weapon profile and severity of the impact (casualties) across time. Each of these components was given its own tab or analysis and displays various information about each.
The shooter tab allows the user to select profile data via a drop down menu. Age, gender, history of mental illness, military experience, or race of the shooter can be selected from the drop-down. 2014 census demographic data is included with race plot, allowing the user to visually compare shooter and population data. This tab was created using the following code:
The weapon tab provides a drop down menu to select weapon category or weapon type. Category refers to the class of weapon, including rifle, shotgun or pistol, while the type refers to whether the weapon is semi-automatic or automatic. This analysis was performed using the following code:
The victim tab allows the user select an annual or month frequency to display victims killed and wounded. The following code is used:
Development for this application, particularly the data munging, was not difficult. The primary challenge was to create an accessible interface that visualized data to encourage interaction and, thereafter, discussion. We wanted to create a product that everyone could use.
The data itself did have some telling features. Of note to the authors was the gun type used, prevalence of previously diagnosed mental illness among the shooters and seasonality to the occurrence of mass shootings events as seen in the image to the left. Our hope is that this type of information will lead to practical and balanced reform, allowing all parties to be satisfied with the outcome.
This project touches the surface of a huge topic. Future work could go in many directions. Along with many other ideas, the authors discussed developing a service to retrieve relevant event data through web scraping and natural language processing.