Brief Summary

Questions Tackled: This study investigates the geographic, seasonal, and structural patterns of rat sightings across New York City’s five boroughs, evaluating whether complaint frequency depends on urban building environment and whether municipal case resolution times differ significantly across boroughs.

Data & Methods: Using geotagged NYC 311 Rat Sightings data hosted reproducibly on GitHub, I built an automated ETL pipeline in R (tidyverse, lubridate, stringr). I standardized building categories, engineered case resolution duration in days, and applied descriptive summaries, Pearson’s Chi-square tests of independence, non-parametric Kruskal-Wallis tests, and multivariable logistic regression.

Main Findings: Rat sightings are heavily concentrated in Brooklyn and Manhattan, with multi-family apartment buildings generating the largest volume of complaints (\(\chi^2\), \(p < 0.001\)). Reports exhibit strong summer seasonality, peaking between June and August. Furthermore, municipal resolution turnaround times vary substantially across boroughs (Kruskal-Wallis \(p < 0.001\)), underscoring opportunities for targeted sanitation resource allocation.

Introduction

Background

Urban rodent management is a persistent public health and infrastructure challenge in dense metropolitan centers. In New York City, the Department of Health and Mental Hygiene (DOHMH) tracks rodent activity largely through the municipal 311 service request system, allowing residents and business owners to log geotagged sightings across residential buildings, commercial establishments, construction sites, and public streets.

Motivation

During a recent visit to New York City over the holiday break, the visible interplay between high-density residential waste management and street-level sanitation prompted an empirical question: to what extent are NYC rat sightings driven by predictable seasonal cycles and specific building types rather than random occurrence? Leveraging open municipal records provides an objective framework to evaluate urban pest dynamics.

Research Objectives

The primary objectives of this exploratory data analysis are: 1. To construct a reproducible R-based ETL workflow capable of ingesting and cleaning large-scale municipal 311 logs. 2. To quantify the distribution of rat sightings across NYC boroughs, months, and built-environment categories. 3. To test statistically whether building environments vary across boroughs and whether municipal resolution times differ significantly by jurisdiction.

Data

Data Source & Collection Methods

The analytical dataset was originally obtained from Kaggle (compiled from NYC 311 Rat Sightings records) and subsequently hosted and version-controlled in my personal public GitHub repository (https://raw.githubusercontent.com/williamllin/nyc-rats/refs/heads/main/Rat_Sightings.csv). Programmatic ingestion via readr::read_csv() with selective column filtering ensures full computational reproducibility and efficient memory management.

Variables

After filtering missing coordinates and unspecified jurisdictions, the cleaned dataset retains 101,208 valid observations. Table 1 outlines the core analytical variables.

Summary of Cleaned Analytical Variables
Variable Type Description
unique_key Identifier Unique 311 service request identifier
created_date_only Date Calendar date when sighting was reported
month / season Ordinal / Categorical Calendar month and meteorological season of report
borough Categorical NYC administrative borough (Bronx, Brooklyn, Manhattan, Queens, Staten Island)
location_clean Categorical Standardized urban built-environment category
status Categorical Administrative ticket status (Closed, Open, Pending)
resolution_days Numeric Engineered elapsed days between report creation and closure
latitude / longitude Numeric WGS84 geographic coordinates of the sighting

Data Limitations

Three methodological limitations apply to 311 administrative records: 1. Citizen Reporting Propensity: Sightings capture public reporting behavior rather than systematic ecological trapping, meaning neighborhoods with higher 311 awareness may exhibit higher reported counts. 2. Right-Censored Open Cases: Recently filed or ongoing tickets lack a Closed Date, restricting resolution duration analysis to closed tickets. 3. Duplicate Address Reports: Multiple tenants within a single large apartment complex may independently file reports for the same underlying infestation.

Methods

ETL Methods & Feature Engineering

Our reproducible ETL workflow was implemented in R using tidyverse, lubridate, and stringr: - Extraction: Selective column loading via read_csv(..., col_select = ...) from the GitHub Raw URL. - Transformation: Standardized borough capitalization, removed records with missing spatial coordinates, and parsed timestamps into ISO date-time objects. - Feature Engineering: Consolidated free-text location_type descriptions into six interpretable urban environments using regular expressions, extracted calendar month and season, and calculated resolution_days (bounded between 0 and 365 days to exclude administrative anomalies).

Statistical Methods & Modeling Techniques

To evaluate structural and operational hypotheses, I applied: 1. Chi-Square Test of Independence: Assessing whether the distribution of built-environment categories (location_clean) is independent of borough. 2. Kruskal-Wallis Non-Parametric ANOVA: Comparing skewed case resolution_days across the five NYC boroughs without assuming normality. 3. Multivariable Logistic Regression: Modeling the probability that a closed case requires prolonged resolution (\(> 14\) days) as a function of borough and season: \[\log\left(\frac{P(\text{Resolution} > 14\text{ days})}{1 - P(\text{Resolution} > 14\text{ days})}\right) = \beta_0 + \sum \gamma_j(\text{Borough}_j) + \sum \theta_m(\text{Season}_m)\]

Results

Summary Tables & Borough Comparisons

Table 2 summarizes total sighting counts, percentage share, closure rates, and resolution time quartiles across NYC’s five boroughs.

NYC Rat Sightings Volume and Resolution Metrics by Borough
Borough Total Sightings Share (%) Closed (%) Median Days IQR Days
Brooklyn 34,467 34.1 76.5 10 15.3
Manhattan 26,491 26.2 66.3 9 12.9
Bronx 20,615 20.4 67.0 8 10.5
Queens 14,742 14.6 79.7 8 10.0
Staten Island 4,893 4.8 80.7 11 20.0

Visual Exploration of Spatial, Seasonal, and Structural Patterns

Figure 1 demonstrates pronounced seasonality across the calendar year, with sightings surging during warmer summer months and tapering off in winter.

Monthly Seasonality of NYC Rat Sightings

Monthly Seasonality of NYC Rat Sightings

Figure 2 illustrates complaint composition across urban environments stratified by borough, highlighting the dominance of multi-family residential dwellings in Brooklyn, Manhattan, and the Bronx, contrasted with higher shares of 1–2 family homes in Queens and Staten Island.

Built-Environment Composition of Rat Sightings by Borough

Built-Environment Composition of Rat Sightings by Borough

Figure 3 maps the spatial distribution of rat sightings across New York City, revealing dense activity corridors throughout Upper Manhattan, Central/North Brooklyn, and the South Bronx.

Spatial Distribution of Geotagged Rat Sightings Across NYC (Sampled n = 8,000)

Spatial Distribution of Geotagged Rat Sightings Across NYC (Sampled n = 8,000)

Statistical Findings

  1. Borough vs. Built Environment Independence: Pearson’s Chi-square test rejected independence between borough and location category (\(\chi^2 = 1.67306\times 10^{4}\), \(df = 20\), \(p < 0.001\)), confirming structural housing differences in where sightings occur.
  2. Resolution Turnaround Disparities: A Kruskal-Wallis test confirmed statistically significant differences in median resolution duration across boroughs (\(H = 560\), \(df = 4\), \(p < 0.001\)).
Logistic Regression Results for Prolonged Case Resolution (> 14 Days)
Term Odds_Ratio Std_Error Z_Value P_Value
(Intercept) 0.398 0.038 -23.94 <0.001
boroughBronx 0.701 0.040 -8.85 <0.001
boroughBrooklyn 1.208 0.032 5.83 <0.001
boroughQueens 0.751 0.041 -6.91 <0.001
boroughStaten Island 1.597 0.056 8.35 <0.001
seasonFall 1.223 0.041 4.93 <0.001
seasonSpring 1.168 0.040 3.85 <0.001
seasonSummer 1.250 0.038 5.80 <0.001

Discussion

Meaning of Results

The empirical findings demonstrate that NYC rat sightings follow systematic urban patterns rather than random noise. Residential density drives baseline complaint volume, particularly in multi-family apartment structures where shared trash storage creates consistent food sources, while warmer temperatures amplify rodent foraging activity and human outdoor reporting.

Practical Implications

Municipal sanitation and pest-control agencies can optimize inspection scheduling by deploying proactive baiting and containerized waste enforcement in high-density multi-family zones during late spring, prior to the summer complaint rise.

Limitations

Because 311 complaints reflect resident reporting behavior, neighborhoods with lower civic engagement may be underrepresented. Also, resolution timestamps record administrative ticket closure rather than longitudinal biological eradication at the address level.

Conclusion

Major Takeaways

  1. Spatial & Structural Concentration: Brooklyn and Manhattan—specifically multi-family residential buildings—account for the dominant share of NYC rat sightings.
  2. Predictable Seasonality: Sightings peak consistently during summer months and decline during winter.
  3. Operational Variation: Municipal case turnaround times vary significantly across boroughs and seasons.

Recommendations & Future Directions

Future research should link 311 rodent logs with NYC Department of Sanitation waste-containerization rollout zones and restaurant health inspection grades to evaluate causal reductions in neighborhood rodent activity.

References

  1. Kaggle. (2026). NYC Rat Sightings Dataset (originally sourced from NYC 311 Service Requests).
  2. Wickham, H., et al. (2019). Welcome to the tidyverse. Journal of Open Source Software, 4(43), 1686.
  3. Cheng, J., Karambelkar, B., & Xie, Y. (2024). leaflet: Create Interactive Web Maps with the JavaScript ‘Leaflet’ Library. R package.