Firearm Mortality in the United States

A Data-Driven Analysis of Gun Deaths and Policy Effectiveness

1 Problem & Objectives

Firearm mortality remains a pressing public health issue in the United States, with gun-related deaths accounting for a significant portion of homicides, suicides, and accidental fatalities. The complexity of this issue extends beyond crime statistics, encompassing social, economic, and policy-driven factors that influence gun violence trends. This project aims to analyze firearm mortality rates across U.S. states and examine the impact of gun control policies, domestic violence-related firearm deaths, and access to mental health resources. By identifying key contributing factors, this study seeks to provide insights into the effectiveness of existing regulations and potential strategies to mitigate firearm-related deaths. This project will contribute to the broader discourse on public safety and policy effectiveness in reducing gun violence.

Code
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
import seaborn as sns
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.colors import LinearSegmentedColormap

# Load dataset
gun_deaths = pd.read_csv("data/merged_data.csv")

# Ensure state names are lowercase for merging
gun_deaths["State"] = gun_deaths["State"].str.lower()

# Define mortality bins and labels
mortality_bins = [0, 10, 15, 20, 25, float("inf")]
mortality_labels = [1, 2, 3, 4, 5]

# Assign states into mortality categories
gun_deaths["mortality_score"] = pd.cut(
    gun_deaths["firearm_mortality_by_state_2022"], 
    bins=mortality_bins, 
    labels=mortality_labels,
    right=False
).astype(float)

states_map = gpd.read_file("data/cb_2018_us_state_20m/cb_2018_us_state_20m.shp")

# Ensure lowercase for merging
states_map["region"] = states_map["NAME"].str.lower()

# Remove Alaska to prevent distortion of the map
states_map = states_map[states_map["region"] != "alaska"]

# Merge state map with gun deaths data
map_data = states_map.merge(gun_deaths, left_on="region", right_on="State", how="left")

# Define color map
colors = ["#68bb59", "#acdf87", "#fab733", "#ff6242", "#c61a09"]
cmap = LinearSegmentedColormap.from_list("custom_cmap", colors)

# Plot Gun Deaths by State
fig, ax = plt.subplots(figsize=(4.5, 3.5))  # Drastically reduced figure size
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="2%", pad=0.05)  # Minimal padding

# Plot states
map_data.plot(column="mortality_score", cmap=cmap, linewidth=0.1, edgecolor="black", ax=ax, legend=True, cax=cax)

# Customize plot
ax.set_title("Firearm Mortality by State (2022)", fontsize=6)  # Tiny font
ax.set_xticks([])
ax.set_yticks([])
ax.set_frame_on(False)

# Add custom legend labels
cbar = plt.gcf().axes[-1]  # Get the colorbar axis
tick_labels = ["Very Low", "Low", "Moderate", "High", "Very High"]
cbar.set_yticks([1.4, 2.2, 3.0, 3.8, 4.6])  # Position the ticks
cbar.set_yticklabels(tick_labels, fontsize=4)  # Tiny font for labels
cbar.tick_params(labelsize=4)  # Tiny tick labels

plt.tight_layout()
plt.show()

As we can see, firearm mortality rates tend to be higher in parts of the South and West, while the Northeast and the far West Coast generally experience much lower rates.

Code
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# Load data
gun_deaths = pd.read_csv("data/merged_data.csv")

# Define bins and labels
bins = [0, 10, 15, 20, 25, float('inf')]
labels = ["Very Low", "Low", "Moderate", "High", "Very High"]

# Assign bins, ensuring no overlap (excluding the right endpoint)
gun_deaths['mortality_bin'] = pd.cut(
    gun_deaths['firearm_mortality_by_state_2022'], bins=bins, labels=labels, right=False
)

# Count states in each bin
gun_death_distribution = gun_deaths['mortality_bin'].value_counts().sort_index().reset_index()
gun_death_distribution.columns = ['mortality_bin', 'State_Count']

# Define colors
colors = {
    "Very Low": "#68bb59",
    "Low": "#acdf87",
    "Moderate": "#fab733",
    "High": "#ff6242",
    "Very High": "#c61a09"
}

# Plot
title = "Firearm Mortality by State (2022)"
subtitle = "Number of States in Each Mortality Range"
plt.figure(figsize=(3.5, 2.5))  # Drastically reduced figure size
ax = sns.barplot(
    y='mortality_bin', x='State_Count', data=gun_death_distribution,
    order=labels, palette=colors, edgecolor='black', linewidth=0.2  # Extremely thin border
)

# Add labels with tiny font and closer to bars
for index, value in enumerate(gun_death_distribution['State_Count']):
    ax.text(value + 0.2, index, str(value), va='center', ha='left', fontsize=5, color='black')

plt.title(f"{title}\n{subtitle}", fontsize=6, weight='normal')  # Tiny title
plt.xlabel("")
plt.ylabel("")
plt.xticks(fontsize=4)  # Tiny tick labels
plt.yticks(fontsize=4)  # Tiny tick labels
plt.grid(axis='x', linestyle="--", alpha=0.5, linewidth=0.5)  # Thinner grid lines
plt.xlim(0, gun_death_distribution['State_Count'].max() + 3)  # Less padding

# Tighter layout
plt.tight_layout()
plt.show()

  • A majority of states (30 out of 51, or nearly 60%) fall into the Low or Moderate categories, suggesting that many parts of the country experience mid-range firearm mortality levels.
  • Only a small number of states (4) face very high firearm mortality, highlighting a concentrated burden in specific regions.
  • The Very Low mortality group is notably smaller, with just 8 states, mostly concentrated in the Northeast and along the Pacific Coast.
  • These findings suggest that regional factors, possibly including policy strength, socioeconomic conditions, or cultural differences, may play a role in shaping firearm mortality outcomes.
Code
# Create Map for Gun Policy Strength Scores
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.colors import LinearSegmentedColormap

# Load dataset (same as before)
gun_deaths = pd.read_csv("data/merged_data.csv")
gun_deaths["State"] = gun_deaths["State"].str.lower()

# Load U.S. state shapefile (without Alaska)
states_map = gpd.read_file("data/cb_2018_us_state_20m/cb_2018_us_state_20m.shp")
states_map["region"] = states_map["NAME"].str.lower()
states_map = states_map[states_map["region"] != "alaska"]  # Remove Alaska

# Merge state map with gun deaths data
map_data = states_map.merge(gun_deaths, left_on="region", right_on="State", how="left")

# Define policy strength bins
policy_bins = [0, 20, 40, 60, 80, 100]
policy_labels = [1, 2, 3, 4, 5]

# Assign states into policy categories
map_data["policy_score"] = pd.cut(
    map_data["gun_policy_strength"], 
    bins=policy_bins, 
    labels=policy_labels,
    right=True
).astype(float)

# Define color map (reversed from mortality map to show stronger policies as better)
policy_colors = ["#c61a09", "#ff6242", "#fab733", "#acdf87", "#68bb59"]
policy_cmap = LinearSegmentedColormap.from_list("policy_cmap", policy_colors)

# Plot Gun Policy Strength by State
fig, ax = plt.subplots(figsize=(4.5, 3.5))  # Drastically reduced figure size
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="2%", pad=0.05)  # Minimal padding

# Plot states
map_data.plot(column="policy_score", cmap=policy_cmap, linewidth=0.1, edgecolor="black", 
              ax=ax, legend=True, cax=cax, missing_kwds={"color": "lightgray"})

# Customize plot
ax.set_title("Gun Policy Strength by State (0-100 Scale)", fontsize=6)  # Tiny font
ax.set_xticks([])
ax.set_yticks([])
ax.set_frame_on(False)

# Add custom legend labels
cbar = plt.gcf().axes[-1]  # Get the colorbar axis
policy_tick_labels = ["Very Weak", "Weak", "Moderate", "Strong", "Very Strong"]  # Shortened labels
cbar.set_yticks([1.4, 2.2, 3.0, 3.8, 4.6])  # Position the ticks
cbar.set_yticklabels(policy_tick_labels, fontsize=4)  # Tiny font for labels
cbar.tick_params(labelsize=4)  # Tiny tick labels

plt.tight_layout()
plt.show()

Interestingly, a large number of states have very weak gun policy strength scores, which is somewhat surprising given the public health risks associated with firearm mortality. This suggests a potential disconnect between the severity of firearm-related outcomes and the strength of preventive legislation in many regions.

2 Motivation and Case Studies

Gun violence remains a critical public health issue in the U.S., with over 48,000 deaths in 2022—a rate of one every 11 minutes. The majority of these deaths are from suicide (55%) and homicide (41%), with additional cases stemming from unintentional injuries and police shootings (Johns Hopkins Center for Gun Violence Solutions, 2023). Over 200 people are treated daily for nonfatal firearm injuries.

Key Drivers of Gun Violence:

Gun Safety Laws: Impact and Patterns

Conclusion

Gun policy strength is a critical factor in reducing firearm violence. States with stronger legislation—especially around storage, background checks, and public carry—see lower mortality rates, while weaker states face higher rates and spillover effects into neighboring regions.

3 Research Questions

Data Science Question: How do social, economic, and policy-related factors influence firearm mortality rates across U.S. states?

Subquestions:

  1. Continuous Predictors (Linear Regression):
  • To what extent do continuous variables—such as incarceration rate, teen birth rate, and education attainment—predict variation in state-level firearm mortality?
  • Are certain socioeconomic indicators (e.g., poverty, unemployment, alcohol-related death rates) more strongly associated with higher firearm mortality?
  1. Binary Predictors (Logistic Regression):
    • How do the presence or absence of specific gun control policies (e.g., assault weapon bans, background checks, domestic violence restrictions) relate to the likelihood of a state falling into a high vs. low mortality category?
    • Which policies appear most protective when controlling for other state-level characteristics?
  2. Modeling Approach:
    • How do different linear regression models compare with eachother in terms of performance?
    • How do different logistic regression models compare with eachother in terms of performance?

4 References

Centers for Disease Control and Prevention. (2015). NCHS - u.s. And state trends on teen births. https://data.cdc.gov/NCHS/NCHS-U-S-and-State-Trends-on-Teen-Births/y268-sna3/about_data
Centers for Disease Control and Prevention. (2022). Stats of the states - firearm mortality. https://www.cdc.gov/nchs/pressroom/sosmap/firearm_mortality/firearm.htm
Centers for Disease Control and Prevention. (2024). Suicide prevention funding. https://www.cdc.gov/injury/budget-funding/suicide-prevention-funding.html
DataPandas. (2024). Domestic violence by state 2024. https://www.datapandas.org/ranking/domestic-violence-by-state
DomesticShelters.org. (n.d.). Domestic violence spending by state. https://www.domesticshelters.org/data-center/state-reports-and-rankings/domestic-violence-spending-per-capita-by-state
Everytown for Gun Safety Support Fund. (2025). Gun law rankings: Gun safety laws save lives. https://everytownresearch.org/rankings/
Everytown Research & Policy. (n.d.a). Prohibition for convicted domestic abusers. https://everytownresearch.org/rankings/law/prohibition-for-convicted-domestic-abusers/
Everytown Research & Policy. (n.d.b). Prohibition for domestic abusers under restraining orders. https://everytownresearch.org/rankings/law/prohibition-for-domestic-abusers-under-restraining-orders/
Everytown Research & Policy. (n.d.c). Relinquishment for convicted domestic abusers. https://everytownresearch.org/rankings/law/relinquishment-for-convicted-domestic-abusers/
Everytown Research & Policy. (n.d.d). Stalker prohibitor. https://everytownresearch.org/rankings/law/stalker-prohibitor/
Gowder, C. (2024). Useful stats: Income inequality across the states. https://ssti.org/blog/useful-stats-income-inequality-across-states
Johns Hopkins Center for Gun Violence Solutions. (2023). Gun violence in the united states. https://publichealth.jhu.edu/center-for-gun-violence-solutions/research-reports/gun-violence-in-the-united-states
K-12 School Shooting Database. (2023). K-12 school shooting database. https://k12ssdb.org/data-visualizations
McGough, M., Amin, K., Panchal, N., & Cox, C. (2023). Child and teen firearm mortality in the u.s. And peer countries. https://www.kff.org/mental-health/issue-brief/child-and-teen-firearm-mortality-in-the-u-s-and-peer-countries/
Mental Health America. (2022). Ranking the states 2022. https://mhanational.org/issues/2022/ranking-states#prevalence_mi
National Center for Education Statistics. (2019). Selected statistics from the public elementary and secondary education universe: School year 2015–16. https://nces.ed.gov/pubs2018/2018052/tables/table_02.asp
National Center for Education Statistics. (n.d.a). Common core of data (CCD). https://nces.ed.gov/ccd/pubschuniv.asp
National Center for Education Statistics. (n.d.b). Private school universe survey (PSS). https://nces.ed.gov/surveys/PSS/tables/TABLE15fl1920.asp
Saunders, H. (2022). Do states with easier access to guns have more suicide deaths by firearm? https://www.kff.org/mental-health/issue-brief/do-states-with-easier-access-to-guns-have-more-suicide-deaths-by-firearm/
Treatment Advocacy Center. (2023). Grading the states. https://www.tac.org/wp-content/uploads/2023/11/Grading-the-States-2020.pdf
U.S. Bureau of Labor Statistics. (2023). Labor force participation rate for women highest in the district of columbia in 2022. https://www.bls.gov/opub/ted/2023/labor-force-participation-rate-for-women-highest-in-the-district-of-columbia-in-2022.htm
U.S. Bureau of Labor Statistics. (2024). Unemployment rates for states. https://www.bls.gov/web/laus/laumstrk.htm
US Census Bureau. (2024). Historical poverty tables: People and families - 1959 to 2023. https://www.census.gov/data/tables/time-series/demo/income-poverty/historical-poverty-people.html
Women in the States. (2013). Highest level of educational attainment of women and men by state, 2013. https://statusofwomendata.org/explore-the-data/poverty-opportunity/additional-state-data/highest-level-of-educational-attainment-of-women-and-men-by-state-2013/
World Population Review. (2021). Crime rate by state 2020. https://worldpopulationreview.com/state-rankings/crime-rate-by-state
World Population Review. (2025). Incarceration rates by state 2025. https://worldpopulationreview.com/state-rankings/incarceration-rates-by-state