Using Tableau to Analyze Mass Shootings in 2015

The recent spate of mass shootings has prompted a lot of analysis in the media, with people looking at all sorts of available data on gun deaths, shootings in general, gun laws, etc.  In our own Tableau community, there have been two excellent visualizations produced off of the widely cited Shooting Tracker database.  Both Andy Kriebel and Dash Davidson put together vizzes that showed how many mass shootings we’ve seen this year and where they’ve taken place.

As happens so often, there were questions I had that the vizzes didn’t answer.  My social media feeds inundate me with wide-ranging opinions on this topic, and while my gut tells me that we’re experiencing an epidemic when it comes to gun violence, I also want to temper (and possibly underpin) my emotional reaction with whatever facts that are available.  So I decided to take a look at the data and see what else it could tell me.  In particular, I wanted to focus on two things:

1. How does 2015 compare to the last two years for which Shooting Tracker has data?  The layouts of Andy and Dash’s vizzes didn’t make that comparison easy.

2. How do the trends hold up if you change the definition of a mass shooting?

***************

1. There’s been a lot of talk about how many mass shootings there have been so far this year, so I wanted to better understand yearly trends, specifically how 2015 is shaping up compared to prior years.  I also liked the idea of showing the sheer magnitude of casualties a la this interactive visualization from The Guardian.

In order to do this, I naturally needed to union the three yearly files together from the Shooting Tracker website.  I could have just used the data in Andy’s workbook, but I knew I needed to augment the data set if I wanted to be able to visualize each casualty vs. just showing the aggregate total by incident.

I used Alteryx to not only union the three files together, but to also generate new rows in the data set, specifically tied to the number of casualties per incident.  The Generate Rows tool, like so much in Alteryx, was elegant and powerful, giving me exactly what I wanted in seconds.

  • I first tallied the Total Casualties by summing the # Dead and the # Injured (native fields in the Shooting Tracker data set)
  • I created a field called BodyCount in the Generate Rows tool
  • I told the tool (via the Condition Expression) to create new rows per Incident so long as the BodyCount (which iterates by 1 after each row) was less than or equal to the Total Casualties.

This resulted in a lot of duplicate entries per incident, but I was able to use the BodyCount field to filter out all but the first row for every view in Tableau that didn’t require each individual casualty.  In other words, filtering a view for BodyCount = 1 essentially gave me the raw data from Shooting Tracker, but when I didn’t filter by Body Count, I was able visualize each individual casualty.  Two data sets for the price of one. 🙂

****************

2. There’s also a lot of debate about what actually defines a mass shooting.  The Shooting Tracker website defines it as any public shooting that injures or kills at least 4 people, but others choose to refine the focus to just deaths, or to a larger number of casualties, or to only certain kinds of incidents.  I personally feel that we shouldn’t quibble about whether someone actually dies before calling something a mass shooting, seeing as “shooting” seems to be the operative verb, but I wanted to build a little flexibility into my viz both to allow people to refine the definition (based on what was available in the Shooting Tracker data) and to see whether the key trends change all that much if you change the definition (i.e. does 2015 become less or more violent if you focus on just deaths vs. any shooting casualty?).

To facilitate this, I created a single Level of Detail field in Tableau that evaluated whether the incident met the conditions for a mass shooting as defined by two parameters I also set up.

  • The parameter Type of Casualty gives the user two choices: Deaths Only or Deaths + Injuries
  • The parameter # of Casualties lets the user select the lower threshold of casualties for defining a mass shooting.  I let them choose between 4 (the Shooting Tracker definition) and 10.
  • The Fixed calculation sums either the total Dead or the total Casualties for every Incident ID and Year (while also making sure to focus on rows where Body Count = 1 to avoid any inflation of numbers) and then compares that to the # of Casualties selected by the user.  If it’s equal to or greater, then it qualifies as a mass shooting.

A sad insight that ensued is that by narrowing the focus to, say, only incidents where at least 5 people died (vs. the broader Shooting Tracker definition of at least 4 shooting victims, both dead and wounded), the gap between 2015 and the last two years actually widens (i.e. 2015 gets worse).  This is clearly a problem we need to fix.

Click the image below to go to my viz and interact with it.  Feedback is definitely welcome.

Thanks for reading.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s