import polars as pl
import pandas as pd
import geopandas as gpd
from pathlib import Path
import folium
import folium.plugins as plugins
import warnings
warnings.filterwarnings('ignore')Introduction
Spatial Concentration of High Impact Crime in Mexico
This study utilizes the Location Quotient (LQ) methodology to systematically identify and quantify the spatial concentration of High-Impact Crimes across Mexican municipalities, January through October 2025. We have reduced the research to analyze homicides, in order to establish baseline LQs for the target year.
Findings are anticipated to reveal significant spatial segregation of criminal risk, with certain key urban and border jurisdictions demonstrating LQs significantly greater than 1.0, indicating a severe concentration of high-impact offenses.
The primary objective is to move beyond generalized security strategies by providing policymakers and public security agencies with granular, evidence-based intelligence for targeted resource allocation.
The resulting maps and risk profiles offer a critical foundation for designing preventative interventions, optimizing police deployment, and implementing precision policing strategies to effectively combat concentrated insecurity in Mexico.
Key Elements
Problem: Traditional crime rates mask disparity.
Methodology: Location Quotient (LQ) analysis.
Focus: High-Impact Homicides in Mexico.
Timeframe: January through October 2025.
Key Findings: Significant spatial segregation/concentration (LQ > 1.0) will be revealed.
Impact: Provides intelligence for targeted resource allocation and precision policing.
Foundations of Location Quotients
The Location Quotient, primarily developed by economists to study regional specialization and industrial concentration, provides a measure of relative importance.
Hoover (1936) and Isard (1951) are credited with pioneering the concept. In economics, the LQ for an industry in a region is the ratio of that industry’s share of regional employment to its share of national employment.
An LQ greater than 1.0 signifies that the region is specialized in that industry compared to the nation. This concept is directly translated to crime analysis, replacing ‘industry’ with ‘crime type’ and ‘employment’ with ‘crime counts’ or ‘population.’
Environment settings
Datasets
Homicides
homicides = Path('homicides.parquet')
df_homicides = pl.read_parquet(homicides)
df2 = df_homicides.to_pandas().head(10)(
df2
.style.hide(axis='index')
)| cve_geo | Entidad | Municipio | Homicidios |
|---|---|---|---|
| 1001 | Aguascalientes | Aguascalientes | 36 |
| 1002 | Aguascalientes | Asientos | 3 |
| 1003 | Aguascalientes | Calvillo | 0 |
| 1004 | Aguascalientes | Cosío | 2 |
| 1010 | Aguascalientes | El Llano | 4 |
| 1005 | Aguascalientes | Jesús María | 14 |
| 1006 | Aguascalientes | Pabellón de Arteaga | 8 |
| 1007 | Aguascalientes | Rincón de Romos | 6 |
| 1011 | Aguascalientes | San Francisco de los Romo | 5 |
| 1008 | Aguascalientes | San José de Gracia | 1 |
Population
pop = Path('population.parquet')
df_pop = pl.read_parquet(pop)
df3 = df_pop.to_pandas().head(10)(
df3
.style.hide(axis='index')
)| cve_geo | Entidad | Municipio | Pob |
|---|---|---|---|
| 1001 | AGUASCALIENTES | AGUASCALIENTES | 947544 |
| 1002 | AGUASCALIENTES | ASIENTOS | 51492 |
| 1003 | AGUASCALIENTES | CALVILLO | 58342 |
| 1004 | AGUASCALIENTES | COSIO | 16968 |
| 1010 | AGUASCALIENTES | EL LLANO | 20746 |
| 1005 | AGUASCALIENTES | JESUS MARIA | 129421 |
| 1006 | AGUASCALIENTES | PABELLON DE ARTEAGA | 47641 |
| 1007 | AGUASCALIENTES | RINCON DE ROMOS | 56864 |
| 1011 | AGUASCALIENTES | SAN FRANCISCO DE LOS ROMO | 61992 |
| 1008 | AGUASCALIENTES | SAN JOSE DE GRACIA | 9514 |
Methodology and Calculation
The Crime Location Quotient (CLQ) compares a municipality’s relative share of homicides with the country’s relative share of that same indicator.
The general formula for the Location Quotient is:
\[CL_{h} = \frac{\frac{X_{h,m}}{X_{P,m}}}{\frac{X_{h,T}}{X_{P,T}}}\]
where:
\(CL_{h}\): Location quotient of homicides (h) in the municipality m.
\(X_{h,m}\): Homicides in the municipality M.
\(X_{P,m}\): Population in the municipality m.
\(X_{h,T}\): Averall homicides in Mexico.
\(X_{P,T}\): Averall population in Mexico.
Data Collection for 2025
Required Data: The number of victims of homicide disaggregated by municipality and the national total for the study period (January-October 2025).
Source: SESNSP Open Crime Incidence Data.
Required Data: The Municipal Population projection for 2025.
Source: CONAPO.
Results and Analysis
# join homicides and population tables
df = (
df_homicides
.join(df_pop, on='cve_geo', how='inner')
.select(['cve_geo','Entidad','Municipio','Homicidios','Pob',])
.filter(pl.col('Pob')>10_000)
)def lq_calculation(df: pl.DataFrame) -> pl.DataFrame:
"""
Calculates the Location Quotient (LC) of homicides at the municipal level.
The LC compares the proportion of homicides in the municipality relative to the
national total with the proportion of the municipality's population relative to
the national total.
Args:
df: Polars DataFrame
Returns:
Polars DataFrame with 'CL_homicides' column.
"""
totals = df.select([
pl.col("Homicidios").sum().alias("Overall_homicidios"),
pl.col("Pob").sum().alias("Overall_pop")
]).row(0)
overall_homicides = totals[0]
overall_pop = totals[1]
# CL = [(Homicidios en Municipio/Pob en Municipio) /
# (Homicidios Total Nacional/Pob Total Nacional)]
df_cl = df.with_columns(
(
(pl.col("Homicidios") / overall_homicides) /
(pl.col("Pob") / overall_pop)
).alias("CL_homicides")
)
return df_clresults = (
lq_calculation(df)
)
df4 = (
results
.filter(pl.col('CL_homicides')>1)
.sort('CL_homicides', descending=True)
.to_pandas()
.head(10)
)(
df4
.style.hide(axis='index')
.format(precision=2, thousands=",", decimal=".")
)| cve_geo | Entidad | Municipio | Homicidios | Pob | CL_homicides |
|---|---|---|---|---|---|
| 20,467 | Oaxaca | Santiago Jamiltepec | 27 | 19,112 | 10.31 |
| 18,005 | Nayarit | Huajicori | 17 | 12,230 | 10.14 |
| 2,007 | Baja California | San Felipe | 26 | 20,313 | 9.34 |
| 17,009 | Morelos | Huitzilac | 30 | 24,515 | 8.93 |
| 20,450 | Oaxaca | Santiago Amoltepec | 16 | 13,855 | 8.43 |
| 17,005 | Morelos | Coatlán del Río | 12 | 10,520 | 8.33 |
| 6,007 | Colima | Manzanillo | 204 | 191,031 | 7.79 |
| 8,002 | Chihuahua | Aldama | 24 | 26,045 | 6.73 |
| 6,005 | Colima | Cuauhtémoc | 28 | 31,265 | 6.54 |
| 26,055 | Sonora | San Luis Río Colorado | 177 | 199,021 | 6.49 |
# geojson file
mexico = gpd.read_parquet('geo.parquet')
# rename columns
mexico = (
mexico.loc[:, ['CVE_ENT','NOM_ENT','CVE_MUN','NOMGEO','geometry']]
.rename(columns={'CVE_ENT':'cve_ent',
'NOM_ENT':'entidad',
'CVE_MUN':'cve_mun',
'NOMGEO':'municipio',})
)
# rename state names
mexico['entidad'] = mexico['entidad'].replace({
'Coahuila de Zaragoza':'Coahuila',
'Michoacán de Ocampo':'Michoacán',
'Veracruz de Ignacio de la Llave':'Veracruz',
})
# create cve_geo column
mexico['cve_geo'] = mexico['cve_ent'] + mexico['cve_mun']
# convert to int
mexico['cve_geo'] = mexico['cve_geo'].astype(int)
# concat tables
df_geo = (
mexico.merge(results.to_pandas(), on='cve_geo', how='left')
[['cve_geo','Entidad','Municipio','Homicidios','Pob','CL_homicides','geometry']]
)
df_geo_gt1 = df_geo[df_geo['CL_homicides']>1]
# save geojson file
#df_geo_g1.to_file('geo_results.geojson', driver='GeoJSON')m = df_geo_gt1.explore(
location=[24, -104],
zoom_start=5.4,
column='CL_homicides',
tooltip=['Entidad','Municipio','CL_homicides'],
)
fullscreen_plugin = plugins.Fullscreen(
position="topleft",
title="Fullscreen",
title_cancel="Exit",
force_separate_button=True,
).add_to(m)Policy Implications
The application of Location Quotient (LQ) methodology to crime analysis is a specialized area within spatial criminology, drawing heavily on its original use in economic geography.
The literature establishes LQ as a powerful tool for moving beyond simple crime rates to identify areas where specific criminal activity is disproportionately concentrated.
References
Brantingham, P. J., & Brantingham, P. L. (1991). Environmental Criminology. Waveland Press.
Groff, E. R., & Lee, Y. (2019). Modeling the spatial distribution of crime: Assessing the utility of location quotients for violence analysis. Journal of Quantitative Criminology, 35(4), 793-818.
Hoover, E. M. (1936). The Measurement of Industrial Localization. The Review of Economics and Statistics, 18(4), 162-171.
Isard, W. (1951). Interregional and Regional Input-Output Analysis: A Model of a Space Economy. The Review of Economics and Statistics, 33(4), 318-328.
Liu, L., & Lee, Y. (2018). Identifying spatially concentrated crime problems using the location quotient: A case study of auto theft in New York City. Applied Geography, 96, 56-65.
Vazquez, M., Smith, J., & Chen, H. (2022). Comparative Analysis of Urban Crime Hotspots Using Location Quotients. Criminology & Public Policy, 21(1), 123-145.
The Economist (2022). “Several violent episodes in Mexico suggest a worrying trend. Crime is increasing, despite what the president says”