Do rat complaints differ systematically between NYC and Chicago
Author
David zhai
Introduction
In the United States, many cities use centralized non-emergency reporting systems like 311, through which residents can report issues including rodent activity. These systems are often viewed as indicators of urban conditions, the complaint volumes are shaped by socioeconomic factors, trust in public institutions, and ease of reporting. Neighborhoods with similar environmental conditions may have different levels of reported complaints, depending on institutional design and resident engagement. Understanding how reporting systems produce observed outcomes is essential for interpreting administrative data and for evaluating the effectiveness of urban policy interventions. This paper examines reported rat activity in two of the largest and densest U.S. cities: New York City and Chicago. Both cities face well established rodent challenges, and maintain extensive 311 reporting infrastructures.The enforcement mechanisms, and public usage of these systems differ in meaningful ways. New York City’s 311 platform emphasizes resident initiated reporting and public transparency, whereas Chicago’s system emphasizes on service requests tied to scheduled baiting and inspection activity. These institutional differences raise an important empirical question: do observed differences in rat complaints reflect true differences in rat prevalence, or differences in how residents and governments engage with reporting systems? To address this question, the study constructs a monthly panel dataset of rat related 311 complaints at the ZIP Code Tabulation Area (ZCTA) level from 2010 through 2025. The analysis combines complaint data with weather conditions, local unemployment rates, and neighborhood characteristics drawn from the American Census. To account for systematic heterogeneity across neighborhoods, ZCTAs are grouped into socioeconomically similar clusters using principal component analysis and k-means clustering. This approach allows comparisons between New York City and Chicago within broadly comparable neighborhood types, reducing confounding from structural differences in income, population density, and racial composition.
Data
The primary outcome variable in this study is the monthly count of rat-related service requests recorded through 311 systems in New York City and Chicago. For both cities, individual service requests are timestamped and geolocated using latitude and longitude coordinates. Records with missing or invalid spatial information are removed. Each observation is assigned to a ZIP Code Tabulation Area (ZCTA) using spatial joins with U.S. Census Bureau ZCTA shapefiles. Service requests are then aggregated to the ZCTA–month level, producing a balanced structure at the neighborhood scale. The resulting dependent variable, rat_count, measures the total number of rat-related 311 requests reported within each ZCTA in a given month. Although both datasets capture rodent-related complaints, it is important to note that they reflect slightly different institutional processes. New York City’s data emphasize resident sightings, while Chicago’s data emphasize service requests tied to baiting and inspection activity. These differences are central to the interpretation of cross-city comparisons in reported outcomes. Weather conditions are used to account for biological and behavioral activity of rats. Daily temperature data are obtained from the National Oceanic and Atmospheric Administration for a central monitoring station in each city. For New York City, observations come from station Central Park, and for Chicago from station Midway Airport. Daily maximum and minimum temperatures are converted Celsius to Fahrenheit and aggregated to the monthly level. For each city and month, average maximum temperature and average minimum temperature are computed. Unemployment rates are included to account for potential correlations between economic stress, time spent in residential environments, and the likelihood to submit 311 complaints. Because unemployment rates vary only at the city month level, they capture broad macroeconomic conditions. Local economic conditions are measured using monthly unemployment rates obtained from the Federal Reserve Economic Data database.
To take into account persistent structural differences across neighborhoods, the analysis uses demographic and socioeconomic data from the American Community Survey. ZCTA-level data includes population size, median household income, poverty rates, and racial and ethnic composition. To reduce dimensionality and avoid multicollinearity, principal component analysis is applied to standardized measures of income, poverty, population size, and racial composition. The first three principal components, which capture the majority of variance in neighborhood characteristics, are used as inputs for k-means clustering. ZCTAs are then grouped into five distinct neighborhood types based on their socioeconomic profiles. This grouping strategy allows comparisons between New York City and Chicago within broadly similar neighborhood contexts, rather than relying on direct one to one ZCTA code matching. Each ZCTA is assigned a fixed group label that remains constant over time. # final dataset The final dataset is structured as an unbalanced panel indexed by ZCTA and month, spanning January 2010 through August 2025. Observations are kept only when rat complaint data, weather variables, and unemployment rates are jointly observed. Monthly indicator variables are constructed to control for seasonality, with January serving as the omitted reference category. The combined dataset includes observations from both cities, with a binary indicator variable identifying New York City versus Chicago.
Chicago New York
1 9 34
2 3 37
3 35 46
4 15 27
5 17 37
Interpretation of groups:
The clustering identifies five distinct neighborhood types that differ systematically in income, poverty, and racial composition. These groups represent meaningful socioeconomic and demographic class. ## Group 1
Group 1 is the most economically disadvantaged cluster, with an average household income of approximately $36,000 and a poverty rate exceeding 30 percent. Racial composition is relatively mixed, with no single majority group. The relatively high standard deviations across racial shares indicate moderate heterogeneity within this group. ## Group 2
Group 2 has moderate incomes of about $61,000 and substantially lower poverty rates. This group is notable for its racial diversity, with a substantial Asian population , alongside White and Hispanic residents. The dispersion measures suggest more internal heterogeneity than other groups. ## Group 3
Group 3 exhibits relatively high average income , around $63,000 and low poverty rates . These neighborhoods are predominantly White, with smaller Black, Asian, and Hispanic populations. Compared to Group 2, Group 3 is more racially homogeneous and economically stable. ## Group 4
Group 4 is economically disadvantaged, with average income around $44,000 and poverty rates above 24 percent. These neighborhoods are overwhelmingly Black , with relatively little racial heterogeneity. Low standard deviations across racial shares indicate strong internal homogeneity. ## Group 5 Group 5 is the most affluent cluster, with average income exceeding $108,000 and poverty rates below 8 percent. These neighborhoods are predominantly White, with small Asian and Hispanic minorities and very little internal heterogeneity. This group is economically and demographically distinct from all others.
Month ZCTA rat_count avg_tmax
Length:6974 Length:6974 Min. : 1.00 Min. :17.11
Class :character Class :character 1st Qu.: 7.00 1st Qu.:48.57
Mode :character Mode :character Median : 13.00 Median :63.72
Mean : 21.35 Mean :62.86
3rd Qu.: 22.00 3rd Qu.:78.58
Max. :596.00 Max. :90.09
avg_tmin average_unemp City MonthDate
Min. :-3.621 Min. : 3.200 Min. :0.0000 Min. :2010-01-01
1st Qu.:34.616 1st Qu.: 4.300 1st Qu.:1.0000 1st Qu.:2013-10-01
Median :47.612 Median : 5.300 Median :1.0000 Median :2017-05-01
Mean :48.116 Mean : 6.295 Mean :0.9012 Mean :2017-07-21
3rd Qu.:63.398 3rd Qu.: 8.500 3rd Qu.:1.0000 3rd Qu.:2021-05-01
Max. :73.342 Max. :17.600 Max. :1.0000 Max. :2025-08-01
MonthNum MonthFactor MonthFactorJan MonthFactorFeb
Min. : 1.000 Jun : 598 Min. :0.00000 Min. :0.00000
1st Qu.: 3.000 Jul : 598 1st Qu.:0.00000 1st Qu.:0.00000
Median : 6.000 Aug : 597 Median :0.00000 Median :0.00000
Mean : 6.422 May : 596 Mean :0.08446 Mean :0.08446
3rd Qu.: 9.000 Mar : 592 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :12.000 Jan : 589 Max. :1.00000 Max. :1.00000
(Other):3404
MonthFactorMar MonthFactorApr MonthFactorMay MonthFactorJun
Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.00000
1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
Median :0.00000 Median :0.00000 Median :0.00000 Median :0.00000
Mean :0.08489 Mean :0.08431 Mean :0.08546 Mean :0.08575
3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :1.00000 Max. :1.00000 Max. :1.00000 Max. :1.00000
MonthFactorJul MonthFactorAug MonthFactorSep MonthFactorOct
Min. :0.00000 Min. :0.0000 Min. :0.00000 Min. :0.00000
1st Qu.:0.00000 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.00000
Median :0.00000 Median :0.0000 Median :0.00000 Median :0.00000
Mean :0.08575 Mean :0.0856 Mean :0.08087 Mean :0.08044
3rd Qu.:0.00000 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :1.00000 Max. :1.0000 Max. :1.00000 Max. :1.00000
MonthFactorNov MonthFactorDec geo_group geometry
Min. :0.00000 Min. :0.00000 Min. :1 MULTIPOINT :6775
1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:1 POINT : 199
Median :0.00000 Median :0.00000 Median :1 epsg:4269 : 0
Mean :0.07872 Mean :0.07929 Mean :1 +proj=long...: 0
3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:1
Max. :1.00000 Max. :1.00000 Max. :1
Show code
summary(group3)
Month ZCTA rat_count avg_tmax
Length:10104 Length:10104 Min. : 1.00 Min. :17.11
Class :character Class :character 1st Qu.: 3.00 1st Qu.:46.83
Mode :character Mode :character Median : 7.00 Median :63.72
Mean : 23.34 Mean :62.25
3rd Qu.: 21.00 3rd Qu.:78.37
Max. :509.00 Max. :90.09
avg_tmin average_unemp City MonthDate
Min. :-3.621 Min. : 3.200 Min. :0.0000 Min. :2010-01-01
1st Qu.:33.697 1st Qu.: 4.400 1st Qu.:1.0000 1st Qu.:2013-08-01
Median :46.250 Median : 5.600 Median :1.0000 Median :2016-12-01
Mean :46.613 Mean : 6.379 Mean :0.7669 Mean :2017-03-29
3rd Qu.:62.192 3rd Qu.: 8.500 3rd Qu.:1.0000 3rd Qu.:2020-09-01
Max. :73.342 Max. :17.600 Max. :1.0000 Max. :2025-08-01
MonthNum MonthFactor MonthFactorJan MonthFactorFeb
Min. : 1.000 Aug : 901 Min. :0.00000 Min. :0.00000
1st Qu.: 4.000 Jul : 899 1st Qu.:0.00000 1st Qu.:0.00000
Median : 6.000 Jun : 885 Median :0.00000 Median :0.00000
Mean : 6.477 May : 877 Mean :0.07829 Mean :0.07937
3rd Qu.: 9.000 Apr : 868 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :12.000 Mar : 847 Max. :1.00000 Max. :1.00000
(Other):4827
MonthFactorMar MonthFactorApr MonthFactorMay MonthFactorJun
Min. :0.00000 Min. :0.00000 Min. :0.0000 Min. :0.00000
1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.0000 1st Qu.:0.00000
Median :0.00000 Median :0.00000 Median :0.0000 Median :0.00000
Mean :0.08383 Mean :0.08591 Mean :0.0868 Mean :0.08759
3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.0000 3rd Qu.:0.00000
Max. :1.00000 Max. :1.00000 Max. :1.0000 Max. :1.00000
MonthFactorJul MonthFactorAug MonthFactorSep MonthFactorOct
Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.00000
1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
Median :0.00000 Median :0.00000 Median :0.00000 Median :0.00000
Mean :0.08897 Mean :0.08917 Mean :0.08343 Mean :0.08205
3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :1.00000 Max. :1.00000 Max. :1.00000 Max. :1.00000
MonthFactorNov MonthFactorDec geo_group geometry
Min. :0.00000 Min. :0.0000 Min. :3 MULTIPOINT :8917
1st Qu.:0.00000 1st Qu.:0.0000 1st Qu.:3 POINT :1187
Median :0.00000 Median :0.0000 Median :3 epsg:4269 : 0
Mean :0.07779 Mean :0.0768 Mean :3 +proj=long...: 0
3rd Qu.:0.00000 3rd Qu.:0.0000 3rd Qu.:3
Max. :1.00000 Max. :1.0000 Max. :3
Show code
summary(group5)
Month ZCTA rat_count avg_tmax
Length:5393 Length:5393 Min. : 1.000 Min. :17.11
Class :character Class :character 1st Qu.: 2.000 1st Qu.:48.72
Mode :character Mode :character Median : 4.000 Median :65.04
Mean : 7.095 Mean :63.26
3rd Qu.: 9.000 3rd Qu.:78.93
Max. :158.000 Max. :90.09
avg_tmin average_unemp City MonthDate
Min. :-3.621 Min. : 3.200 Min. :0.0000 Min. :2010-01-01
1st Qu.:34.616 1st Qu.: 4.400 1st Qu.:1.0000 1st Qu.:2013-11-01
Median :48.776 Median : 5.400 Median :1.0000 Median :2017-03-01
Mean :47.794 Mean : 6.283 Mean :0.7996 Mean :2017-06-22
3rd Qu.:63.104 3rd Qu.: 8.400 3rd Qu.:1.0000 3rd Qu.:2021-02-01
Max. :73.342 Max. :17.600 Max. :1.0000 Max. :2025-08-01
MonthNum MonthFactor MonthFactorJan MonthFactorFeb
Min. : 1.000 Aug : 511 Min. :0.00000 Min. :0.00000
1st Qu.: 4.000 Jul : 497 1st Qu.:0.00000 1st Qu.:0.00000
Median : 7.000 Jun : 492 Median :0.00000 Median :0.00000
Mean : 6.554 Oct : 484 Mean :0.07528 Mean :0.07306
3rd Qu.: 9.000 May : 472 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :12.000 Sep : 463 Max. :1.00000 Max. :1.00000
(Other):2474
MonthFactorMar MonthFactorApr MonthFactorMay MonthFactorJun
Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.00000
1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
Median :0.00000 Median :0.00000 Median :0.00000 Median :0.00000
Mean :0.07881 Mean :0.08289 Mean :0.08752 Mean :0.09123
3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :1.00000 Max. :1.00000 Max. :1.00000 Max. :1.00000
MonthFactorJul MonthFactorAug MonthFactorSep MonthFactorOct
Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.00000
1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
Median :0.00000 Median :0.00000 Median :0.00000 Median :0.00000
Mean :0.09216 Mean :0.09475 Mean :0.08585 Mean :0.08975
3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
Max. :1.00000 Max. :1.00000 Max. :1.00000 Max. :1.00000
MonthFactorNov MonthFactorDec geo_group geometry
Min. :0.00000 Min. :0.00000 Min. :5 MULTIPOINT :4109
1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:5 POINT :1284
Median :0.00000 Median :0.00000 Median :5 epsg:4269 : 0
Mean :0.07806 Mean :0.07065 Mean :5 +proj=long...: 0
3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:5
Max. :1.00000 Max. :1.00000 Max. :5
Empirical Strategy and Model Specification
The objective of this analysis is to assess whether differences in reporting systems contribute to systematic differences in reported rat sightings between New York City and Chicago, conditional on comparable neighborhood characteristics. Because raw comparisons across cities risk confounding institutional differences with underlying socioeconomic and demographic variation, the empirical strategy proceeds in two steps: grouping ZCTA codes into comparable neighborhood types, and then estimating regression models within these matched groups.
Show code
panel_data1 <-pdata.frame(group1, index =c("ZCTA", "MonthDate"))panel_data2 <-pdata.frame(group2, index =c("ZCTA", "MonthDate"))panel_data3 <-pdata.frame(group3, index =c("ZCTA", "MonthDate"))panel_data4 <-pdata.frame(group4, index =c("ZCTA", "MonthDate"))panel_data5 <-pdata.frame(group5, index =c("ZCTA", "MonthDate"))formula <- rat_count ~ avg_tmax+ avg_tmin + City + average_unemp+ MonthFactorFeb + MonthFactorMar + MonthFactorApr + MonthFactorMay + MonthFactorJun + MonthFactorJul + MonthFactorAug + MonthFactorSep + MonthFactorOct + MonthFactorNov + MonthFactorDecre_model1 <-plm(formula, data = panel_data1, model ="random")summary(re_model1)
he resulting dataset is a ZCTA month panel spanning 2010–2025. The primary outcome variable is the number of reported rat sightings in a given ZCTA code and month. Each observation is associated with a city indicator, neighborhood group membership, weather controls (average monthly minimum and maximum temperatures), local unemployment rates, and month fixed effects to account for seasonality
- RatCountz,t is the number of rat sightings reported in ZCTA code zzz during month ttt. - _{0,1} is an indicator variable equal to 0 if ZCTA code zzz is located in Chicago and 1 if it is located in New York City, which serves as the reference category.
beta_1^{(g)} , text{avg_tmax}_{it} + _2^{(g)} , text{avg_tmin}_i is a vector of time-varying controls, including average monthly maximum and minimum temperatures and the local unemployment rate, which account for environmental and economic conditions that may influence rat activity and reporting behavior.
_m^{(g)} denotes month fixed effects, which capture common seasonal patterns in rat sightings across cities, such as higher reports during warmer months.
εz,t_{z,t}εz,t is the error term, capturing unobserved factors that vary across ZCTA codes and over time.
To further enhance comparability, the model is estimated separately within each neighborhood group. This approach allows the city coefficient to be interpreted as the difference in reported rat sightings between Chicago and New York City within socioeconomically similar ZCTA, rather than across the full and highly heterogeneous landscape.This group strategy avoids reliance on strong assumptions required by random effects models and mitigates concerns that unobserved ZCTA characteristics such as housing density, sanitation infrastructure, or historical pest prevalence are correlated with city membership.
Results
## 5.1 Temperature Effects
Across all neighborhood groups, temperature variables are statistically significant and display consistent directional effects. Higher average maximum temperature is positively associated with rat sightings, while higher average minimum temperature is negatively associated. However, the magnitude of these effects is moderate. A 10°F increase in average maximum temperature is associated with approximately 4 to 27 additional monthly rat sightings, depending on neighborhood group, while a comparable increase in minimum temperature reduces reported sightings by roughly 2 to 16. These results suggest that temperature influences rat activity and reporting behavior, but weather alone explains only a limited share of overall variation in rat complaints relative to seasonal and institutional factors.
## 5.2 Seasonal Patterns Month fixed effects are uniformly negative relative to January, which serves as the reference month. This indicates that, conditional on weather and economic conditions, reported rat sightings are highest in January across all neighborhood groups. This pattern likely reflects increased indoor rat activity and heightened reporting during winter months, rather than biological seasonality alone. Because temperature is explicitly controlled for, the month effects capture non-climatic seasonal factors such as reporting behavior, building usage patterns, and enforcement cycles.
## 5.3 Economic Conditions Local unemployment rates are negatively associated with rat sightings in all specifications. A one-percentage-point increase in unemployment is associated with approximately 0.3 to 1.6 fewer monthly rat reports, depending on neighborhood group. While this relationship is not the primary focus of the analysis, it suggests that economic conditions may influence reporting behavior or service utilization rather than underlying rat prevalence. ## 5.4 City-Level Differences
The estimated coefficient on the city indicator is large, statistically significant, and robust across all model specifications and neighborhood groupings. Because the city variable is coded as 1 for New York City and 0 for Chicago, the negative coefficient implies that, holding constant weather conditions, local economic factors, and seasonal effects, ZCTA codes in New York City consistently report fewer rat sightings than observationally similar ZCTA codes in Chicago.
<b/>
The magnitude of this difference is substantial. Depending on the neighborhood group, New York City ZCTA codes report between approximately 20 and 50 fewer rat sightings per month relative to Chicago ZCTA.
The diversity of the city effect across neighborhood groups further supports this interpretation. The estimated New York City reporting gap is largest in lower-income and higher-density neighborhoods, where residents may be more likely to engage with a simple, targeted reporting system. In contrast, the gap is smaller in higher-income ZCTA codes, where residents may rely on private pest control services or alternative reporting channels that are not captured in public 311 data. This pattern is consistent with a mechanism in which institutional design interacts with neighborhood characteristics to shape reporting behavior.
Additionally, the persistence of the city effect after controlling for month fixed effects is particularly important. Month fixed effects absorb broad seasonal patterns in reporting behavior that are common across cities. The fact that a sizable city coefficient remains indicates that the observed differences are not driven by differences in seasonal timing, weather seasonality, or cyclical public awareness campaigns.
Taken together, these findings suggest that the observed disparity in rat sightings between Chicago and New York City is unlikely to reflect differences in environmental conditions. Instead, the results are consistent with the hypothesis that Chicago’s 311 reporting system generates higher reported rat activity through lower reporting barriers and more standardized complaint categorization. While the analysis does not establish causality, it provides strong descriptive evidence that institutional reporting structures play a central role in shaping observed urban pest complaint data.
<b/>
5.5 Model Fit and Variation
The models explain between 11% and 21% of total variation in rat sightings, depending on neighborhood group. Decomposition of variance components indicates that both within ZCTA and ZCTA variation contribute meaningfully to observed outcomes, supporting the use of panel methods. Importantly, the persistence of the city effect after conditioning on temperature and month fixed effects suggests that observed differences in reported rat sightings between Chicago and New York City are unlikely to be driven by climate or seasonal patterns alone.
panel_data1$City <-factor(panel_data1$City)panel_data2$City <-factor(panel_data2$City)panel_data3$City <-factor(panel_data3$City)panel_data4$City <-factor(panel_data4$City)panel_data5$City <-factor(panel_data5$City)panel_data1$pred <-predict(re_model1)ggplot(panel_data1, aes(x = pred, y = rat_count, color = City)) +geom_point(alpha =0.4) +geom_abline(slope =1, intercept =0, linetype ="dashed", color ="black") +scale_color_brewer(palette ="Set2") +labs(title ="Predicted vs Actual Rat Counts (Group 1)",x ="Predicted",y ="Observed",color ="City" ) +theme_minimal()
Show code
panel_data2$pred <-predict(re_model2)ggplot(panel_data2, aes(x = pred, y = rat_count, color = City)) +geom_point(alpha =0.4) +geom_abline(slope =1, intercept =0, linetype ="dashed", color ="black") +scale_color_brewer(palette ="Set2") +labs(title ="Predicted vs Actual Rat Counts (Group 2)",x ="Predicted",y ="Observed",color ="City" ) +theme_minimal()
Show code
panel_data3$pred <-predict(re_model3)ggplot(panel_data3, aes(x = pred, y = rat_count, color = City)) +geom_point(alpha =0.4) +geom_abline(slope =1, intercept =0, linetype ="dashed", color ="black") +scale_color_brewer(palette ="Set2") +labs(title ="Predicted vs Actual Rat Counts (Group 3)",x ="Predicted",y ="Observed",color ="City" ) +theme_minimal()
Show code
panel_data4$pred <-predict(re_model4)ggplot(panel_data4, aes(x = pred, y = rat_count, color = City)) +geom_point(alpha =0.4) +geom_abline(slope =1, intercept =0, linetype ="dashed", color ="black") +scale_color_brewer(palette ="Set2") +labs(title ="Predicted vs Actual Rat Counts (Group 4)",x ="Predicted",y ="Observed",color ="City" ) +theme_minimal()
Show code
panel_data5$pred <-predict(re_model5)ggplot(panel_data5, aes(x = pred, y = rat_count, color = City)) +geom_point(alpha =0.4) +geom_abline(slope =1, intercept =0, linetype ="dashed", color ="black") +scale_color_brewer(palette ="Set2") +labs(title ="Predicted vs Actual Rat Counts (Group 5)",x ="Predicted",y ="Observed",color ="City" ) +theme_minimal()
Show code
ggplot(group1, aes(x = MonthDate, y = rat_count, group = ZCTA)) +geom_line(alpha =0.2) +stat_summary(aes(group =1), fun = mean, geom ="line",linewidth =1.2, color ="black") +labs(title ="Rat Count Trends Over Time (Group 1)",y ="Rat Count" ) +theme_minimal()
Show code
ggplot(group2, aes(x = MonthDate, y = rat_count, group = ZCTA)) +geom_line(alpha =0.2) +stat_summary(aes(group =2), fun = mean, geom ="line",linewidth =1.2, color ="black") +labs(title ="Rat Count Trends Over Time (Group 2)",y ="Rat Count" ) +theme_minimal()
Show code
ggplot(group3, aes(x = MonthDate, y = rat_count, group = ZCTA)) +geom_line(alpha =0.2) +stat_summary(aes(group =3), fun = mean, geom ="line",linewidth =1.2, color ="black") +labs(title ="Rat Count Trends Over Time (Group 3)",y ="Rat Count" ) +theme_minimal()
Show code
ggplot(group4, aes(x = MonthDate, y = rat_count, group = ZCTA)) +geom_line(alpha =0.2) +stat_summary(aes(group =4), fun = mean, geom ="line",linewidth =1.2, color ="black") +labs(title ="Rat Count Trends Over Time (Group 4)",y ="Rat Count" ) +theme_minimal()
Show code
ggplot(group5, aes(x = MonthDate, y = rat_count, group = ZCTA)) +geom_line(alpha =0.2) +stat_summary(aes(group =5), fun = mean, geom ="line",linewidth =1.2, color ="black") +labs(title ="Rat Count Trends Over Time (Group 5)",y ="Rat Count" ) +theme_minimal()
Show code
group1$Group <-"Group 1"group2$Group <-"Group 2"group3$Group <-"Group 3"group4$Group <-"Group 4"group5$Group <-"Group 5"library(dplyr)all_groups <-bind_rows(group1, group2, group3, group4, group5)ggplot(all_groups, aes(x = MonthDate, y = rat_count, group =interaction(Group, ZCTA))) +geom_line(alpha =0.15, aes(color = Group)) +stat_summary(aes(group = Group, color = Group),fun = mean,geom ="line",linewidth =1.4 ) +scale_color_brewer(palette ="Set1") +labs(title ="Rat Count Trends Over Time by Group",y ="Rat Count",color ="Group" ) +theme_minimal()
conclusion
This analysis shows clear differences in reported rat sightings between Chicago and New York City, even after accounting for weather, unemployment, and seasonal effects. Chicago ZCTA codes consistently show higher monthly counts, suggesting that institutional and reporting mechanisms, rather than purely environmental factors, shape observed complaint patterns. Neighborhood level heterogeneity further highlights how local demographics interact with reporting systems. These findings indicate the importance of considering institutional context when interpreting urban pest data and suggest that city-level differences in reporting infrastructure can significantly influence the patterns captured in public complaint datasets.