Gunshot Deaths during Police Interactions - Patterns on Age, Gender, and Race

1. Load Data

1.1 Import Fatal Encounters csv

fatal <- read.csv("FATAL ENCOUNTERS DOT ORG SPREADSHEET (See Read me tab) - Form Responses.csv")

1.2 Import ACS state data

acs_state <- tidycensus::get_acs(geography = "state",
                                 variables = c(hhincome = 'B19013_001'),
                                 year = 2023,
                                 output = "wide",
                                 geometry = TRUE) %>%
  #drop AK, HI, PR leaving CONUS as study area
  filter(!(NAME %in% c("Alaska", "Hawaii", "Puerto Rico")))
##   |                                                                              |                                                                      |   0%  |                                                                              |                                                                      |   1%  |                                                                              |=                                                                     |   1%  |                                                                              |=                                                                     |   2%  |                                                                              |==                                                                    |   2%  |                                                                              |==                                                                    |   3%  |                                                                              |===                                                                   |   4%  |                                                                              |===                                                                   |   5%  |                                                                              |====                                                                  |   5%  |                                                                              |====                                                                  |   6%  |                                                                              |=====                                                                 |   7%  |                                                                              |=====                                                                 |   8%  |                                                                              |======                                                                |   8%  |                                                                              |======                                                                |   9%  |                                                                              |=======                                                               |  10%  |                                                                              |=======                                                               |  11%  |                                                                              |========                                                              |  11%  |                                                                              |========                                                              |  12%  |                                                                              |=========                                                             |  13%  |                                                                              |==========                                                            |  14%  |                                                                              |==========                                                            |  15%  |                                                                              |===========                                                           |  15%  |                                                                              |===========                                                           |  16%  |                                                                              |============                                                          |  17%  |                                                                              |============                                                          |  18%  |                                                                              |=============                                                         |  18%  |                                                                              |=============                                                         |  19%  |                                                                              |==============                                                        |  20%  |                                                                              |==============                                                        |  21%  |                                                                              |===============                                                       |  21%  |                                                                              |===============                                                       |  22%  |                                                                              |================                                                      |  23%  |                                                                              |=================                                                     |  24%  |                                                                              |=================                                                     |  25%  |                                                                              |==================                                                    |  25%  |                                                                              |==================                                                    |  26%  |                                                                              |===================                                                   |  27%  |                                                                              |===================                                                   |  28%  |                                                                              |====================                                                  |  28%  |                                                                              |====================                                                  |  29%  |                                                                              |=====================                                                 |  30%  |                                                                              |=====================                                                 |  31%  |                                                                              |======================                                                |  31%  |                                                                              |======================                                                |  32%  |                                                                              |=======================                                               |  32%  |                                                                              |=======================                                               |  33%  |                                                                              |========================                                              |  34%  |                                                                              |========================                                              |  35%  |                                                                              |=========================                                             |  35%  |                                                                              |=========================                                             |  36%  |                                                                              |==========================                                            |  37%  |                                                                              |==========================                                            |  38%  |                                                                              |===========================                                           |  38%  |                                                                              |===========================                                           |  39%  |                                                                              |============================                                          |  40%  |                                                                              |=============================                                         |  41%  |                                                                              |=============================                                         |  42%  |                                                                              |==============================                                        |  42%  |                                                                              |==============================                                        |  43%  |                                                                              |===============================                                       |  44%  |                                                                              |===============================                                       |  45%  |                                                                              |================================                                      |  45%  |                                                                              |================================                                      |  46%  |                                                                              |=================================                                     |  47%  |                                                                              |=================================                                     |  48%  |                                                                              |==================================                                    |  48%  |                                                                              |==================================                                    |  49%  |                                                                              |===================================                                   |  49%  |                                                                              |===================================                                   |  50%  |                                                                              |====================================                                  |  51%  |                                                                              |====================================                                  |  52%  |                                                                              |=====================================                                 |  52%  |                                                                              |=====================================                                 |  53%  |                                                                              |======================================                                |  54%  |                                                                              |======================================                                |  55%  |                                                                              |=======================================                               |  55%  |                                                                              |=======================================                               |  56%  |                                                                              |========================================                              |  57%  |                                                                              |=========================================                             |  58%  |                                                                              |=========================================                             |  59%  |                                                                              |==========================================                            |  59%  |                                                                              |==========================================                            |  60%  |                                                                              |===========================================                           |  61%  |                                                                              |===========================================                           |  62%  |                                                                              |============================================                          |  62%  |                                                                              |============================================                          |  63%  |                                                                              |=============================================                         |  64%  |                                                                              |=============================================                         |  65%  |                                                                              |==============================================                        |  65%  |                                                                              |==============================================                        |  66%  |                                                                              |===============================================                       |  66%  |                                                                              |===============================================                       |  67%  |                                                                              |================================================                      |  68%  |                                                                              |================================================                      |  69%  |                                                                              |=================================================                     |  69%  |                                                                              |=================================================                     |  70%  |                                                                              |==================================================                    |  71%  |                                                                              |==================================================                    |  72%  |                                                                              |===================================================                   |  73%  |                                                                              |===================================================                   |  74%  |                                                                              |====================================================                  |  74%  |                                                                              |====================================================                  |  75%  |                                                                              |=====================================================                 |  75%  |                                                                              |=====================================================                 |  76%  |                                                                              |======================================================                |  77%  |                                                                              |======================================================                |  78%  |                                                                              |=======================================================               |  78%  |                                                                              |=======================================================               |  79%  |                                                                              |========================================================              |  80%  |                                                                              |========================================================              |  81%  |                                                                              |=========================================================             |  81%  |                                                                              |=========================================================             |  82%  |                                                                              |==========================================================            |  83%  |                                                                              |===========================================================           |  84%  |                                                                              |===========================================================           |  85%  |                                                                              |============================================================          |  85%  |                                                                              |============================================================          |  86%  |                                                                              |=============================================================         |  87%  |                                                                              |=============================================================         |  88%  |                                                                              |==============================================================        |  88%  |                                                                              |==============================================================        |  89%  |                                                                              |===============================================================       |  90%  |                                                                              |===============================================================       |  91%  |                                                                              |================================================================      |  91%  |                                                                              |================================================================      |  92%  |                                                                              |=================================================================     |  92%  |                                                                              |=================================================================     |  93%  |                                                                              |==================================================================    |  94%  |                                                                              |==================================================================    |  95%  |                                                                              |===================================================================   |  95%  |                                                                              |===================================================================   |  96%  |                                                                              |====================================================================  |  97%  |                                                                              |====================================================================  |  98%  |                                                                              |===================================================================== |  98%  |                                                                              |===================================================================== |  99%  |                                                                              |======================================================================| 100%

1.3 Data cleaning for analysis

fatal_gunshot <-  fatal %>%
  #filter to only deaths by gunshot, drop AK, HI, PR leaving CONUS as study area
  filter(Highest.level.of.force == "Gunshot",
         !(State %in% c("AK", "HI", "PR"))) %>%
  mutate(
    #add "region" column to fatal df
    Region = case_when(
      State %in% c("ME", "NH", "VT", "MA", "RI", "CT", "NY", "NJ", "PA") ~ "Northeast",
      
      State %in% c("OH", "IN", "IL", "MI", "WI",
                   "MN", "IA", "MO", "ND", "SD", "NE", "KS") ~ "Midwest",
      
      State %in% c("DE", "MD", "DC", "VA", "WV", "NC", "SC", "GA", "FL",
                   "KY", "TN", "AL", "MS", "AR", "LA", "OK", "TX") ~ "South",
      
      State %in% c("MT", "ID", "WY", "CO", "NM", "AZ", "UT", "NV") ~ "Mountain West",
      
      State %in% c("WA", "OR", "CA") ~ "Pacific",
      
      TRUE ~ "Other"
    ),
    #extract year to separate column
    Year = str_sub(Date.of.injury.resulting.in.death..month.day.year., -4, -1),
    #add column n for count
    n=1) %>%
  #select only columns in need
  select(age=Age, 
         gender=Gender, 
         race=Race, 
         date=Date.of.injury.resulting.in.death..month.day.year.,
         year=Year,
         state=State, 
         region=Region,
         lon=Longitude,
         lat=Latitude,
         n=n)

#check if all columns have been assigned region
if (!("Other" %in% fatal_gunshot$Region)){
  print("All columns have been assigned to a region.")
}
## [1] "All columns have been assigned to a region."
acs_state <- acs_state %>%
  #add state abbreviation column to acs_state df
  mutate(state_abb = case_when(
    NAME == "District of Columbia" ~ "DC",
    TRUE ~ state.abb[match(NAME, state.name)]
  )) %>%
  #drop NA values in state abbreviation name
  drop_na()

#summarize total gunshot death count by state
fatal_gunshot_summarize <- fatal_gunshot %>%
  select(state, n) %>%
  group_by(state) %>%
  summarise(totaldeath = sum(n, na.rm = TRUE))

#join summarized fatal_gunshot to acs_state df
acs_state_count <- acs_state %>%
  left_join(fatal_gunshot_summarize, by = c("state_abb" = "state")) %>%
  select(name=NAME,
         state_abb,
         totaldeath)  

#convert fata_gunshot df to sf object, match crs with acs_state_count
fatal_gunshot_sf <- st_as_sf(
  fatal_gunshot,
  coords = c("lon", "lat"),  # your coordinate column names
  crs = 4326                            # EPSG:4326 = WGS84 (standard lat/lon)
)
acs_state_count <- st_transform(acs_state_count, st_crs(fatal_gunshot_sf))

2. Create Plots/Graphs

2.1 Map 1 - Total Gunshot Deaths during Police Interactions

2.2 Plot 1 - Line Plot of Annual Total Gunshot Deaths by Region

#summarize total gunshot death count by region and year
fatal_gunshot_summarize_region <- fatal_gunshot %>%
  select(region, n, year) %>%
  group_by(region, year) %>%
  summarise(totaldeath = sum(n, na.rm = TRUE))

#plot
ggplot(fatal_gunshot_summarize_region, 
            aes(x = as.numeric(year), y=totaldeath, color=region, group=region)) +
    geom_line(linewidth = 0.7) +
    geom_point(size = 1.7) +
    #create x-axis main axis breaks and minor axis breaks
    scale_x_continuous(breaks = seq(2000, 2021, by = 5),
                       minor_breaks = seq(2000, 2021, by = 1)) + 
    labs(
      title = "Annual Total Gunshot Deaths by Region",
      x = "Year",
      y = "Total Deaths")

2.3 Plot 2 - Stacked Bar Chart of Total Gunshot Deaths by Age Group and Gender

fatal_gunshot_binned <- fatal_gunshot %>%
  #clean data by removing na values and empty age and gender values
  drop_na(c(age, gender)) %>%
  filter(age != "",
         gender != "",
         #filter out ages that are no integers
         as.numeric(age) %% 1 == 0) %>%
  #create age bins
  mutate(age_group = cut(
    as.numeric(age),
    breaks = seq(0, 100, by = 10), # 10-year bins
    include.lowest = TRUE,
    labels = paste(seq(0, 90, by = 10), "-", seq(10, 100, by = 10))
  ),
  #reorder visualization order of gender
  gender = factor(gender, levels = c("Male", "Female", "Transgender"))) %>%
  #summarize total deaths by gender across age groups
  group_by(age_group, gender, region) %>%
  summarise(totaldeaths = sum(n)) %>%
  drop_na(age_group)

#plot
ggplot(fatal_gunshot_binned, aes(x = age_group, y = totaldeaths, fill = gender)) +
  geom_col(color = "white") +
  scale_y_log10() +
  scale_fill_manual(values = c(
    "Male" = "#6d98ba", # blue
    "Female" = "#d3b99f", # red
    "Transgender" = "#b6bbbf"
  )) +
  labs(
    title = "Total Gunshot Deaths by Age Group and Gender",
    x = "Age Group",
    y = "Count (log)",
    fill = "Gender"
  ) +
  #separate plot by region
  facet_wrap(~region) +
  #vertical x-axis label
  theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))

2.4 Plot 3 - Bar Chart of Total Gunshot Deaths by Race

fatal_gunshot_race <- fatal_gunshot %>%
  #clean data by removing na values
  drop_na(race) %>%
  mutate(
    #simply race categories
    race = case_when(
      race %in% c("European-American/White", "European-American/European-American/White", "Middle Eastern") ~ "White",
      
      race %in% c("African-American/Black", "African-American/Black African-American/Black Not imputed") ~ "Black",
      
      race %in% c("Hispanic/Latino") ~ "Hispanic/\nLatino",
      
      race %in% c("Asian/Pacific Islander") ~ "Asian",
      
      race %in% c("Native American/Alaskan") ~ "American\nIndian",
      
      TRUE ~ "Unspecified"
    )
  ) %>%
  #summarize total deaths by race
  group_by(race, region) %>%
  summarise(totaldeaths = sum(n))

#plot
ggplot(fatal_gunshot_race, aes(x = race, y = totaldeaths, fill =race)) +
  geom_col(width = 0.7, color = "white") +
  scale_fill_brewer(palette = "Set3") +
  scale_y_log10() +
  labs(
    title = "Total Gunshot Deaths by Race",
    x = "Race",
    y = "Count (log)"
  ) +
  #separate plot by region
  facet_wrap(~region) +
  #vertical x-axis label
  theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5),
        legend.position = "none") #remove legend since color already tells race apart 

Narrative

    The analysis looks into the patterns regarding fatal police shootings in the United States with respect to age, gender, and race. The study begins with looking at the spatial trends for the entire U.S. from 2000 to 2021.In Map 1, we can see that many of the Southeastern states have higher total deaths, while Northern states closer to Canada have less total deaths; this may be related to population density in general. We can also see denser clusters around major metro areas such as Los Angeles and Atlanta. In Plot 1, we see that, over time, the South has the greatest increase in total gunshot deaths among all regions, rising from around 200 to 600 in 10 years, showcasing regional disparities in police gun violence.

    The analysis then proceeds to start looking into specific demographic patterns regarding gun violence during police interactions. In Plot 2, regarding age and gender, we see that victims are dominantly male, and among male victims, most are between 20-40 years old. Female victims are in smaller proportions, followed by transgender victims. In Plot 3, regarding race, the white, Hispanic/Latino, and African American/Black population generally have the top 3 total gunshot deaths across all regions. Regionally, the Pacific has the highest Hispanic/Latino gunshot deaths, and the South has the highest African American/Black deaths. The total count can be further normalized by racial population data within the regions to see if there over- or under-representation in the data comparison.

    All plots/maps and insights from these figures together reveal that fatal police interactions through gunshots are not random, but may reflect systematic differences across age, gender, and race, and these differences may also vary by time and region.