Visualizing the Factors Associated With Homicide in Philadelphia in 2022 Using Publicly Available Data

The dots on a map may seem like they are clustering, but are they just indicating the clustering of something else?

René F. Najera, MPH, DrPH
5 min readNov 15, 2022


Using Philadelphia’s open data portal, I downloaded the Part 1 crime data reported between January 1 and November 8, 2022. I then filtered the data for only criminal homicides, and I threw the location of those homicides on the map of neighborhoods in Philadelphia shown below.

Map of neighborhoods in Philadelphia with red dots showing the location of homicides.

At first glance, you might see some clustering of the red dots here and there. Clusters naturally catch our attention and we are drawn to them. Some people might even estimate their risk of being killed by looking at where they live and the location of those visual clusters.

What About Population Size?

To account for population size, it is necessary to get the population of the locations of those homicides. For this exercise, I downloaded the 2015–2020 population estimates from the American Community Survey (ACS) from the US Census Bureau. (I used the tidycensus package in R.) Now, let’s join the dots to their respective census tracts, and then calculate a rate of homicides by census tract. This is the map that results:

Map of neighborhoods in Philadelphia with rate of homicides per 10,000 residents by census tract.

Now, we see there are census tracts with very high homicide rates. Interestingly, those census tracts don’t cluster too tightly with each other. There are some tracts with low or no homicides around them, while there are others bordering census tracts with lower homicide rates. (Please keep in mind that some neighborhoods, like Airport and Navy_Yard, are not residential areas.)

The question remains: Are homicides clustering in those places with high homicide rates? Or is it something else?

Wealth Inequality

Well, we know that poverty is directly related to crime in a given area in the United States, so let’s look at a map of poverty, using the ACS data again from 2015–2020:



René F. Najera, MPH, DrPH

DrPH in Epidemiology. Associate/JHBSPH. Adjunct/GMU. Epidemiologist. Father. Husband. (He/Him/His/El)