Audience. This story is written for state legislators, public-health officials, and community advocates who are debating whether stronger gun laws can save lives.
Instructions The CDC publishes firearm mortality for each State per 100,000 persons https://www.cdc.gov/nchs/pressroom/sosmap/firearm_mortality/firearm.htm. Each State’ firearm control laws can be categorized as very strict to very lax. The purpose of this Story is to answer the question, ” Do stricter firearm control laws help reduce firearm mortality?”
For this assignment you will need to:
Access the firearm mortality data from the CDC using an available API (https://open.cdc.gov/apis.html)
Create a 5 point Likert scale categorizing gun control laws from most lax to strictest and assign each state to the most appropriate Likert bin.
Determine wether stricter gun control laws result in reduced gun violence deaths
Present your story using heat maps
Notes:
You may not use the same desktop application that you have used for a previous story.
If you use color in your visuals you must use an accessible color palette.
Firearm deaths are a persistent public-health crisis in the United States. Even compared with other high-income countries, the U.S. stands out for its high rates of gun homicide and suicide. Yet the “United States” is not one single gun regime: each state sets its own rules around background checks, permits, concealed carry, and access to specific types of weapons.
For policymakers, a natural question is whether these different policy choices show up in the mortality data:
Are states with stricter gun laws meaningfully safer, or are firearm death rates similar regardless of regulation?
To explore this question, I combine two sources:
By aligning these two datasets for the most recent year available, I build a set of maps and charts that show how firearm mortality varies across states and across law-strictness categories.
This initial preview confirms that the CDC API returns quarterly, age-adjusted mortality rates by cause of death. Each row corresponds to a “12 months ending with quarter” period, and the columns include the cause of death, the rate type, and separate rate fields for each state and demographic group.
I first narrow the dataset to a single outcome: firearm-related injury, keeping only age-adjusted rates over a 12-month period. From there, I keep only columns whose names start with rate_ and correspond to individual states, dropping overall and sex-specific rates and the age-group column. Counting non-missing values by quarter shows that from 2023 Q1 through 2024 Q4 there is complete data for all states in each quarter, so later analysis uses the most recent quarter only.
## [1] "2024 Q4"
To make fair state-to-state comparisons, I select a single point-in-time snapshot instead of mixing quarters. The latest quarter with complete state coverage in this pull is 2024 Q4, so all subsequent analysis uses this period.
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 3.70 11.70 14.20 14.61 18.80 28.00 1
I then reshape the data so that each row represents one state in that quarter. The column state_name holds the readable state name, and death_rate contains that state’s firearm death rate per 100,000 people in 2024 Q4. This tidy structure makes it straightforward to join with other state-level information and to create visualizations.
## [1] 50
Finally, I join the firearm mortality data with a lookup table of state names and postal abbreviations. The resulting gun_mortality table has exactly 50 rows—one for each U.S. state—with both the full name and two-letter abbreviation alongside the firearm death rate, ready to be mapped and compared.
The gun-law table assigns each state to a five-point Likert scale based on the overall strictness of its firearm regulations, using public scorecards and policy summaries. A value of 1 represents very lax laws, while 5 represents very strict laws. This categorical variable is what I use to compare policy environments across states.
Lastly, I merge the firearm mortality data and the gun-law scale into a single dataset. Each row now includes the state name, firearm death rate, Likert score for gun-law strictness, and a descriptive label. This combined table is the foundation for all of the visualizations and summaries in the results section.
In this section, I look at how firearm deaths are distributed across
the United States.
By mapping the latest age-adjusted firearm mortality rate for each
state, we can see which parts of the country bear the highest burden of
gun-related deaths before adding any information about gun laws.
plot_ly(
data = gun_data,
type = "choropleth",
locations = ~state_abbr,
locationmode = "USA-states",
z = ~death_rate,
colorscale = "Plasma",
colorbar = list(title = "Deaths per 100,000")
) %>%
layout(
title = paste0(
"Firearm Mortality Rate by State (", unique(gun_data$year_and_quarter), ")"
),
geo = list(
scope = "usa",
projection = list(type = "albers usa"),
showlakes = TRUE,
lakecolor = "white"
)
)
The choropleth map makes it clear that firearm mortality is not evenly spread across the country. States across the Deep South, parts of the Mountain West, and Alaska stand out in darker shades, indicating some of the highest firearm death rates in the nation. In contrast, many states in the Northeast, Upper Midwest, and along the West Coast appear in lighter colors, reflecting comparatively lower firearm mortality. This geographic divide suggests that regional factors—such as policy, culture, economics, and access to firearms—may play an important role. The map does not explain those drivers on its own, but it provides a visual baseline that we will compare against patterns in state gun-law strictness in the next sections.
In this section, I map how strict or lax each state’s gun laws are with using a five-point Likert scale. This lets us compare the policy environment across states before directly linking it to firearm death rates.
gun_data_plot <- gun_data %>%
mutate(
law_likert_num = as.numeric(law_likert),
law_likert_text = as.character(law_label)
)
plot_ly(
data = gun_data_plot,
type = "choropleth",
locations = ~state_abbr,
locationmode = "USA-states",
z = ~law_likert_num,
colorscale = "Viridis",
colorbar = list(
title = "Gun-Law Strictness",
tickvals = 1:5,
ticktext = levels(gun_data$law_label)
)
) %>%
layout(
title = "Gun-Law Strictness by State (Likert 1-5)<br><sup>1 = Very lax, 5 = Very strict</sup>",
geo = list(
scope = "USA",
projection = list(type = "albers usa"),
showlakes = TRUE,
lakecolor = "white"
)
)
This map shows a clear regional pattern in gun-law strictness. States in the Northeast and along the West Coast are mostly coded as “Strict” or “Very Strict,” reflecting more comprehensive background checks, permit requirements, and limits on certain types of firearms. In contrast, much of the South, Great Plains, and Mountain West are shaded as “Lax” or “Very Lax,” indicating fewer restrictions and more permissive carry and purchase rules. When we compare this map to the earlier mortality map, an inverse pattern starts to emerge: regions with stricter gun laws tend to be the same regions with relatively lower firearm death rates, while areas with very lax laws overlap with many of the highest-mortality states. The next visuals quantify that relationship more directly.
In this section, I move from maps to a summary view by averaging firearm death rates within each gun-law category. This shows how mortality changes as states move from very lax to very strict gun policies.
law_summary <- gun_data %>%
group_by(law_likert, law_label) %>%
summarise(
mean_death_rate = mean(death_rate, na.rm = TRUE),
median_death_rate = median(death_rate, na.rm = TRUE),
.groups = "drop"
)
law_summary
plot_ly(
data = law_summary,
x = ~law_label,
y = ~mean_death_rate,
type = 'bar',
marker = list(color = ~mean_death_rate, colorscale = "Plasma"),
text = ~paste0(round(mean_death_rate, 1), " deaths/100k"),
hoverinfo = "text"
) %>%
layout(
title = "Average Firearm Death Rate by Gun-Law Strictness",
xaxis = list(title = "Gun-Law Strictness (Likert scale)"),
yaxis = list(title = "Avg Deaths per 100,000")
)
The bar chart summarizes the relationship between gun-law strictness and firearm mortality. States with very lax gun laws have by far the highest average death rate, close to 19 deaths per 100,000 people. States in the lax, moderate, and strict categories all fall in the mid-teens, showing some variation but generally lower mortality than the very lax group. The most striking contrast is the very strict category: these states average fewer than 7 deaths per 100,000, less than half the rate of the very lax states. While the middle categories are not perfectly ordered, the overall pattern is clear—states with the loosest gun laws experience the highest firearm death rates, and the states with the strictest laws experience the lowest.
In this final view, I look at each state individually. Instead of averages, this scatter plot shows how firearm death rates vary within each gun-law category.
plot_ly(
data = gun_data,
x = ~law_likert,
y = ~death_rate,
type = "scatter",
mode = "markers",
text = ~state.name,
hovertemplate = paste(
"%{text}",
"Strictness: %{x}",
"Deaths per 100k:%{y:.1f}"
),
marker = list(
size = 9,
color = ~law_likert,
colorscale = "Viridis",
showscale = FALSE
)
) %>%
layout(
title = "Firearm Death Rate vs Gun-Law Strictness by State",
xaxis = list(
title = "Gun-Law Strictness (1 = very lax, 5 = very strict)",
dtick = 1
),
yaxis = list(
title = "Firearm deaths per 100,000"
)
)
Each point on this scatter plot represents a single state, positioned by its gun-law strictness on the x-axis and its firearm death rate on the y-axis. States with very lax laws (1) cluster toward the left and generally sit high on the chart, with several exceeding 20 deaths per 100,000 people. As we move to lax (2), moderate (3), and strict (4) categories, the points tend to shift downward, although there is still noticeable overlap and a few outliers. The very strict (5) states stand out: almost all of them fall below 10 deaths per 100,000, forming a tight, low cluster on the right. This view reinforces the earlier findings—while gun-law strictness is not the only factor that matters, states with the loosest laws are consistently overrepresented among the highest death rates, and states with the strictest laws are concentrated among the lowest.
The set of visualizations tells a broadly consistent story. The mortality map shows that firearm deaths are concentrated in certain regions, especially parts of the South and Mountain West, while many states with lower mortality are clustered in the Northeast and on the West Coast. The gun-law map reveals almost the reverse pattern: the regions with the strictest gun laws largely coincide with the regions that have the lowest firearm death rates.
The averaged view by gun-law category sharpens this pattern. States with very lax gun laws have the highest average firearm mortality, while states with very strict laws have the lowest, with less than half as many deaths per 100,000 people on average. The state-by-state scatter plot confirms that this is not just an artifact of averaging: most of the highest-mortality states fall into the very lax category, and most very strict states cluster at the low end of the death-rate scale.
At the same time, these results should be interpreted with caution. The gun-law Likert scale is a simplified summary of complex legal regimes. The analysis uses a single recent period (2024 Q3) rather than long-run trends, and it does not control for other factors such as poverty, urbanization, crime rates, or demographics that also influence violence. The visuals show strong associations between gun-law strictness and mortality, but they do not by themselves prove causation.
The evidence from this analysis points in a clear direction. States with the loosest gun laws consistently experience the highest firearm death rates, while states with the strictest laws experience the lowest. This pattern appears on the national maps, in the averages by policy category, and in the state-level scatter plot. Taken together, these views suggest that a stricter gun-law environment is strongly associated with fewer firearm deaths.
However, gun violence is a complex outcome, and policy is only one part of the picture. Economic conditions, social factors, and historical patterns of violence all matter as well. This story does not claim that stricter laws alone can solve the problem of firearm mortality, nor that every strict-law state is automatically safe.
What it does show is that, at the national level, states that choose more comprehensive gun regulations tend to have substantially lower firearm death rates than those that do not. For policymakers and the public, the data support the idea that stronger gun laws can be an important component of a broader strategy to reduce firearm-related deaths in the United States.