On Nov. 1 The Trace published a story about the steady decline in gun shooting deaths since the pandemic. Here’s how we did it.
Why we did our analysis
By the end of the summer, it was becoming clear from a variety of sources, including city dashboards and FBI data, that something big was happening in gun violence. Somewhat unexpectedly, after years of sky-high rates, starting during the pandemic, shootings were going down dramatically in cities across the United States.
Rather than waiting for quarterly law enforcement data to come out, or end-of-year figures from the Centers for Disease Control and Prevention, which are not finalized until the following summer, we wanted to take advantage of one of the things that makes the Gun Violence Archive special: It tracks incidents in near-real time.
But comparing a still incomplete 2024 with previous years was a challenge, particularly because there is seasonality in gun violence data. Gun violence tends to go up during hot months and then decrease in the fall. We could see that shooting deaths went down in September. But did they go down more than expected?
There is also a lot of bounce in local shooting data. In all but the most violent jurisdictions, a single incident in which five people are shot would be enough to move the needle. We wanted readers to be able to see past this randomness, as well.
How we produced our results
We considered various ways to seasonally adjust and fit a trend, but ultimately decided to use a technique called Seasonal and Trend decomposition using Loess. This technique seemed best able to identify seasonality in cities where the number of observed shootings can be both small and volatile from month to month.
Decomposing a time series means breaking it into component parts. Here is a decomposition of national shooting data from Gun Violence Archive from 2014 – 2024:
Our original time series – shootings per month – has been broken down into a seasonal component, a trend, and irregular values, which portray the element of randomness. The trend lets us know how shootings deaths are changing over time, once we take out the seasonal effect and some noise. It is conceptually similar to a rolling average, but requires a few more mathematical steps.
To generate an STL model, the user must set a smoothing parameter. For our analysis we achieved the best result when we set the smoothing parameter to seven, but we tested larger values to make sure the decreasing trends weren’t erased or reversed.
Using R version 4.4.1 and the very helpful ggseas package by Peter Ellis, we pulled Gun Violence Archive data on the number of shootings per month in each city from January 2014 to September 2024. We then generated a new decomposition for each city.
What we found
We identified downward trends in a number of different cities. We chose to visualize a cross-section of them in our graphic. Readers who, like us, have been following gun violence for a long time, will recognize many of the cities as places that come up in our reportage again and again.
Here is a chart of each city featured showing both the trend line and the observed numbers of shootings:
This makes clear that the trend line is increasing the visibility of a pattern that is somewhat perceptible to the naked eye in the underlying data: In cities across America, shooting deaths are trending down to a significant degree.
How we determined that the cities with the largest decreases are run by Democrats
Again using R, we calculated the number of shootings from January 1 through September 30 of 2023 and 2024. We filtered out cities that had fewer than three shooting deaths per month in 2023 to avoid a small numbers problem. We then calculated the percent change and ranked the remaining cities. We used Ballotpedia to assign a party affiliation to each city’s mayor.
How do you know your time series decompositions are valid and not off the wall?
In general, it is good practice to corroborate finding with reality, so we sought out sources that could be a good check.
The Real Time Crime Index uses data from Unified Crime Reports to produce a 12-month rolling average.of homicides in many cities. Though this data isn’t as current as the Gun Violence Archive, and the 12-month rolling average means trends can be slower to appear, this was a good place to confirm that our findings weren’t drastically different, as most shootings in GVA are homicides and most homicides are committed with guns. We checked each city we visualized here.
In each city we highlighted, we also sought corroborating news reports, like this story about how homicides in San Francisco might be at a 60-year low this year.