# miami to mumbai
As is true all over the world, not every neighborhood is created equal. I thought it would be interesting to get a view of how the different _barrios_ of Argentina's capital compare to cities I'm familiar with in the USA and elsewhere in the world.
Specifically, I'm going to look at two measures: **Homicide Rate** (per 100,000 people), and **Population Density** (per square kilometer). See "Methodology" section below for more details.
_Note: I designed all of the visualizations below using d3.js._
## homicide rates by barrio
Annual homicides per 100,000 residents. Overlay of latitude and longitude points for each homicide, 2016 - 2019.
![[media/mm1.svg]]
Interesting that Puerto Madero (the wealthiest, most secure "neighborhood") would be relative to Chacarita, my old barrio with it's little villa. We can see pretty clearly the "_medialuna sur_" - Constitución, Barracas, Nueva Pompeya, Villa Soldati, and Bajo Flores.
Retiro's very high rate is very clearly a function of its [_villa miseria_](https://en.wikipedia.org/wiki/Villa_miseria) (informal, unsafe encampment, slum), in Buenos Aires, the Villa 31. In fact, we can see clusterings of points (individual homicides) around villas - note clusters around Constitución and Villas 31, 21-24, 1-11-14.
## homicides from 2016-2019
By Month, Weekday, and Hour.
![[media/mm2.svg]]
As we can see from the above radial charts, weekends during late hours seem to correspond to the most "homicidal" times.
## population density by barrio
Residents per square kilometer, scale in thousands.
![[media/mm3.svg]]
Almagro and Balvanera are an interesting case of bordering, similarly sized, similarly populated, similarly dense barrios with vastly different homicide rates. Unfortunately, at this higher level of "barrio" we can't really get a good sense of whether there is a relationship between density and the homicide rate.
I assumed that perhaps you'd see a relationship since we do see clusterings around the villas, which are densely populated. However, that density is then diluted by the surrounding areas.
## methodology
The Buenos Aires city government publishes data regarding "delitos," crimes.
One such crime is _homicidio doloso_, specifically homicide with criminal intent.
First, I filtered the data for the four years 2016 - 2019 (nearly half a million rows) to remove any incidents which did not meet the following condition:
```text
tipo_delito === "Homicidio" && subtipo_delito === "Doloso"
```
I was left with 509 observations, 496 of which have data about the neighborhood (henceforth interchangeably referred to as _barrio_) where the crime occured and even include specific latitude and longitude coordinates.
Next, I pulled in population data for each barrio as of 2010. The population has certainly grown in the last decade, but I do not want to manipulate this data to try to project that growth and risk _understating_ the homicide rate for any given barrio, so I leave this as a caveat, knowing that in all likelihood I'm _overstating_ the homicide rate. This to me is the more honest, cautious error to make.
Next, I used a GeoJSON file of the neighborhoods of the city which includes as one of its feature properties a measure of square meters. I simply divided this by `1e6 (1,000,000)` to determine the area by square kilometer. These results were very close to other statistics I was able to find online.
To calculate homicide rate I averaged the number of homicides per barrio per year, summing the data for 2016 - 2019 for each barrio and dividing by 4 (years), then dividing that number by the population of the barrio divided by `1e5 (100,000)`. This ultimately renders the "average" homicide rate per 100,000 residents for the years 2016 - 2019.
Values for benchmark homicide rates and population densities came from the following Wikipedia pages.
- [Crime Rates in US Cities](https://en.wikipedia.org/wiki/List_of_United_States_cities_by_crime_rate)
- [Population Density of Cities Proper](https://en.wikipedia.org/wiki/List_of_cities_proper_by_population_density)
- [Population Density of US Cities](https://en.wikipedia.org/wiki/List_of_United_States_cities_by_population_density)