This project looks at Chicago traffic crashes from 2021 to 2025 and studies whether weather, lighting, time of day, speed limit, and crash type are related to whether a crash causes an injury. The data came from the City of Chicago’s Traffic Crashes dataset. I created a binary outcome for whether each crash had at least one injury. I used visualizations to compare injury rates across the selected variables, and a logistic regression model to study their relationships with injury rate. About 547,840 crashes were included in the analysis, and about 85,477 involved at least one injury. All five predictors were significant overall. Crash type had the strongest relationship with injury risk, especially for pedestrian and pedalcyclist crashes. Higher speed limits and worse sight (such as darkness and fog) were also linked to higher injury rates. The results only suggest association, not cause and effect.
Traffic crash is an important public safety issue because some only result in property damage while some cause injuries to people. Understanding which characteristics are associated with injury can help describe patterns in how severe a crash would be.
The research question for this project is:
How are weather, lighting, time of day, speed limit, and crash type related to whether a Chicago traffic crash causes an injury?
The goal is to compare injury rates across these conditions and use logistic regression to study their relationships with injury.
The data come from the City of Chicago Traffic Crashes - Crashes dataset. Each row represents one reported traffic crash.
This analysis uses crashes from 2021 through 2025. The selected variables are:
injury_crash: whether any injury occurredposted_speed_limit: posted speed limitcrash_hour: hour of the crashweather_condition: recorded weather conditionlighting_condition: recorded lighting conditionfirst_crash_type: type of first collisionSome limitations of the data are that it only includes reported crashes, and some crash details may contain reporting error. The dataset is also very large, so even fairly small relationships can become statistically significant, even if the variable may not have a large practical effect.
crashes |>
summarise(
total_crashes = n(),
injury_crashes = sum(injury_crash),
injury_rate = round(mean(injury_crash) * 100, 1)
)
## # A tibble: 1 × 3
## total_crashes injury_crashes injury_rate
## <int> <int> <dbl>
## 1 547840 85477 15.6
The data were cleaned by changing column names to lowercase, selecting the variables needed for the analysis, converting crash dates to date-time values, keeping only crashes from 2021 through 2025, and removing rows with missing injury totals.
The binary outcome injury_crash variable:
crashes |>
count(injury_crash)
## # A tibble: 2 × 2
## injury_crash n
## <lgl> <int>
## 1 FALSE 462363
## 2 TRUE 85477
Graphs and visualizations were used to compare injury rates by hour, weather, lighting, speed limit, and crash type.
A logistic regression model was then fitted since the outcome has two categories: injury and no injury.
model <- glm(
injury_crash ~ posted_speed_limit + crash_hour +
weather_condition + lighting_condition + first_crash_type,
data = crashes, family = binomial
)
summary(model)
##
## Call:
## glm(formula = injury_crash ~ posted_speed_limit + crash_hour +
## weather_condition + lighting_condition + first_crash_type,
## family = binomial, data = crashes)
##
## Coefficients:
## Estimate Std. Error z value
## (Intercept) -1.9872254 0.6572634 -3.023
## posted_speed_limit 0.0459852 0.0009155 50.232
## crash_hour -0.0093524 0.0007308 -12.797
## weather_conditionBLOWING SNOW -0.2517000 0.6698045 -0.376
## weather_conditionCLEAR -0.2199575 0.6563454 -0.335
## weather_conditionCLOUDY/OVERCAST -0.1941448 0.6567711 -0.296
## weather_conditionFOG/SMOKE/HAZE -0.0905232 0.6654413 -0.136
## weather_conditionFREEZING RAIN/DRIZZLE -0.2665471 0.6599322 -0.404
## weather_conditionOTHER 0.0707880 0.6596862 0.107
## weather_conditionRAIN -0.1680930 0.6564721 -0.256
## weather_conditionSEVERE CROSS WIND GATE -0.4519024 0.7749341 -0.583
## weather_conditionSLEET/HAIL -0.2979762 0.6698196 -0.445
## weather_conditionSNOW -0.4873340 0.6568245 -0.742
## weather_conditionUNKNOWN -0.9543494 0.6569937 -1.453
## lighting_conditionDARKNESS, LIGHTED ROAD 0.2366639 0.0219686 10.773
## lighting_conditionDAWN 0.0766735 0.0372450 2.059
## lighting_conditionDAYLIGHT -0.1415210 0.0212818 -6.650
## lighting_conditionDUSK 0.0237928 0.0322509 0.738
## lighting_conditionUNKNOWN -0.6286658 0.0410958 -15.298
## first_crash_typeANIMAL -1.4383998 0.1775173 -8.103
## first_crash_typeFIXED OBJECT -0.4407867 0.0191248 -23.048
## first_crash_typeHEAD ON 0.4957361 0.0325398 15.235
## first_crash_typeOTHER NONCOLLISION -0.3960793 0.0709993 -5.579
## first_crash_typeOTHER OBJECT -0.3866008 0.0362804 -10.656
## first_crash_typeOVERTURNED 0.6030820 0.1114263 5.412
## first_crash_typePARKED MOTOR VEHICLE -1.9708854 0.0171945 -114.623
## first_crash_typePEDALCYCLIST 2.1194002 0.0247431 85.656
## first_crash_typePEDESTRIAN 3.2068230 0.0289005 110.961
## first_crash_typeREAR END -0.7288165 0.0128010 -56.934
## first_crash_typeREAR TO FRONT -1.7964156 0.0509814 -35.237
## first_crash_typeREAR TO REAR -2.4824613 0.1791645 -13.856
## first_crash_typeREAR TO SIDE -1.2696041 0.0563666 -22.524
## first_crash_typeSIDESWIPE OPPOSITE DIRECTION -0.8320550 0.0370828 -22.438
## first_crash_typeSIDESWIPE SAME DIRECTION -1.6979628 0.0172410 -98.484
## first_crash_typeTRAIN 0.8003029 0.3954667 2.024
## first_crash_typeTURNING -0.4701773 0.0131185 -35.841
## Pr(>|z|)
## (Intercept) 0.0025 **
## posted_speed_limit < 2e-16 ***
## crash_hour < 2e-16 ***
## weather_conditionBLOWING SNOW 0.7071
## weather_conditionCLEAR 0.7375
## weather_conditionCLOUDY/OVERCAST 0.7675
## weather_conditionFOG/SMOKE/HAZE 0.8918
## weather_conditionFREEZING RAIN/DRIZZLE 0.6863
## weather_conditionOTHER 0.9145
## weather_conditionRAIN 0.7979
## weather_conditionSEVERE CROSS WIND GATE 0.5598
## weather_conditionSLEET/HAIL 0.6564
## weather_conditionSNOW 0.4581
## weather_conditionUNKNOWN 0.1463
## lighting_conditionDARKNESS, LIGHTED ROAD < 2e-16 ***
## lighting_conditionDAWN 0.0395 *
## lighting_conditionDAYLIGHT 2.93e-11 ***
## lighting_conditionDUSK 0.4607
## lighting_conditionUNKNOWN < 2e-16 ***
## first_crash_typeANIMAL 5.37e-16 ***
## first_crash_typeFIXED OBJECT < 2e-16 ***
## first_crash_typeHEAD ON < 2e-16 ***
## first_crash_typeOTHER NONCOLLISION 2.42e-08 ***
## first_crash_typeOTHER OBJECT < 2e-16 ***
## first_crash_typeOVERTURNED 6.22e-08 ***
## first_crash_typePARKED MOTOR VEHICLE < 2e-16 ***
## first_crash_typePEDALCYCLIST < 2e-16 ***
## first_crash_typePEDESTRIAN < 2e-16 ***
## first_crash_typeREAR END < 2e-16 ***
## first_crash_typeREAR TO FRONT < 2e-16 ***
## first_crash_typeREAR TO REAR < 2e-16 ***
## first_crash_typeREAR TO SIDE < 2e-16 ***
## first_crash_typeSIDESWIPE OPPOSITE DIRECTION < 2e-16 ***
## first_crash_typeSIDESWIPE SAME DIRECTION < 2e-16 ***
## first_crash_typeTRAIN 0.0430 *
## first_crash_typeTURNING < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 474451 on 547839 degrees of freedom
## Residual deviance: 383179 on 547804 degrees of freedom
## AIC: 383251
##
## Number of Fisher Scoring iterations: 6
Injury rates are visibly much higher during dark hours, highest past midnight.
This graph only shows speed limit values with more than 500 reported crashes. The general trend is that as speed limit increases, injury rates increase drastically. From a speed limit of 20 mph to 40 mph, the injury rate increased more than twice as much.
This graph only shows weather conditions with more than 500 reported crashes. Weather was statistically significant overall in the logistic regression model, but none of the individual weather levels were significantly different from the reference weather level.
This graph only shows lighting conditions with more than 500 reported crashes (which happens to be all lighting groups). Lighting condition was significantly related to injury status overall. Some lighting levels were statistically significant while others were not.
This graph only shows crash types with more than 500 reported crashes. Crash type showed the strongest relationship with injury. Pedestrian and pedalcyclist crashes had especially high injury rates compared with the model’s reference crash type.
drop1(model, test = "Chisq")
## Single term deletions
##
## Model:
## injury_crash ~ posted_speed_limit + crash_hour + weather_condition +
## lighting_condition + first_crash_type
## Df Deviance AIC LRT Pr(>Chi)
## <none> 383179 383251
## posted_speed_limit 1 385871 385941 2692 < 2.2e-16 ***
## crash_hour 1 383341 383411 163 < 2.2e-16 ***
## weather_condition 11 384004 384054 825 < 2.2e-16 ***
## lighting_condition 5 384937 384999 1759 < 2.2e-16 ***
## first_crash_type 17 463886 463924 80707 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
All five predictors were statistically significant overall. Crash type showed the most significance since it had the largest likelihood-ratio test statistic by far, then speed limit and lighting condition. Weather and crash hour contribute less but still significant.
The results show that injury risk is not evenly distributed across crash conditions. Crash type was the strongest predictor in the model. Pedestrian and pedalcyclist crashes were especially likely to involve injuries. Higher posted speed limits were also associated with higher injury rates.
Lighting, weather, and crash hour were statistically significant overall, but their relationships were not as strong. Because the dataset contains a very large number of crashes, even small effects can become statistically significant, so the strength of the relationships are more important than just statistical significance.
It is interesting that the highest injury rates are usually not caused by worse driving conditions, such as total darkness and blowing snow. This makes sense since these conditions would lead to less cars on the road, slower driving speed, and more careful drivers. Injury rates seem to be higher under conditions that make it harder to see, but not perceived as dangerous.
The dataset only includes reported crashes, so unreported crashes are not represented. Some variables like weather and lighting conditions are recorded by officers and may contain reporting errors. The analysis also does not include every possible factor related to injury, such as vehicle type and driver behavior or information. Also the study results only suggest association, not cause and effect.
Out of the 5 selected variables, crash type had the strongest relationship with whether a Chicago traffic crash caused an injury. Pedestrian and pedalcyclist crashes showed especially high injury rates. Higher posted speed limits were also associated with higher injury rates. Lighting, weather, and crash hour showed smaller but statistically significant overall relationships, suggesting that worse driving sight (darkness, fog, etc.) is related to higher injury rates.
Future analyses could consider vehicle type, city/community area, and how severe the injury was, instead of only injury vs. no injury.
City of Chicago. Traffic Crashes - Crashes. Chicago Data Portal.