Data Analysis on Vehicular Collisions within NYC
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
New York City — data shows it's known for its fast walkers, busy people, and of course aggressive drivers. Many people who live here know that it is a nightmare to drive here; there are too many cars, too few parking spots, jaywalkers, cyclists, flashing lights, honking, and the list goes on. It's no wonder that after living here for a majority of my life that traffic conditions in Boston felt very tame in comparison.
When I was in Boston for college, the local Bostonians would say that their driving experience there was horrible. Some of my Indian coworkers would compare Boston's traffic with India's traffic while others coworkers who have visited New York would say New York is more like India. So just how crazy are New York City's drivers?
To explore that question, I looked at it from the perspective of vehicular collisions. I wanted to find out the where, when, and why vehicular collisions were occurring:
- Where are most of the collisions occurring? Where are the main pain points in NYC?
- When are the collisions occurring — do we see any trends with the time by hour of day and by month?
- Why are the collisions occurring? We want to take a look at the top reasons why New Yorkers get into car crashes.
I used NYPD's Motor Vehicular Collisions dataset which is provided by the NYC Open Data repository. This dataset is built for the Vision Zero initiative. Vision Zero is a program that started in 2014 and is intended to halve the number of traffic fatalities by 2025. The dataset has about 900k rows with 30 observations ranging from July 2012 to YTD 2016. The dataset is updated every weekday; the batch of data I used was to 10/11/2016. After finding the purpose of the dataset, the last question and elephant in the room is:
- Is Vision Zero working so far? That is, have we been seeing a decreasing trend for fatalities within NYC?
Data Current State of NYC
To get a general sense of the current state of NYC's vehicular collisions, I made a choropleth representing the YTD vehicular collisions in NYC. Since the data comes as individual records of collision incidents, I had to slice up the date column to extract the year. Then, after aggregating the data by year and zip code, I used the choroplethrZip library to create a map of NYC for 2016 YTD collisions:
Visually inspecting this choropleth, we can see that the main pain points in NYC are:
- Heavy traffic density/population neighborhoods and hip neighborhoods like:
- Midtown (not surprisingly!)
- Long Island City
- Poor neighborhoods:
- East New York and Canarsie area
These observations were in line with what I expected; neighborhoods with many people and cars as well as less wealthy neighborhoods with bad infrastructure are expected to be pain points. But when, and why are these areas pain points? First, to understand when these collisions are occurring, I wanted to look at the collisions by hour of day. Before doing any analysis, I expected the morning rush to be the most dangerous as people are tired and groggy while going to work.
To analyze this, I stripped the hour from the time field of each collision incident and then aggregated the data by hour and count of incidents. A ggplot with a geom_bar worked perfectly for this visualization:
It turns out that while the morning rush starting at 8AM does start the day's collisions, most of the collisions happen around 4-5PM — quitting time for a majority of people. One explanation to this is that more people are awake during these hours (people who don't follow the traditional 9 to 5) compounded by the annoyed workers trying to get home ASAP. I performed a similar analysis by month to see if certain months are worse than others, but there was no apparent trend.
To explore the last facet of NYC's collisions, I turned to the contributing factors for the collisions. If the majority of these collisions are happening due to a certain set of reasons, countermeasures can be implemented to prevent them. First, I aggregated the count of contributing factors for the entire dataset:
|4||Failure to Yield Right-of-Way||36776|
It turns out that a majority of these collisions are not actually crazy or aggressive drivers, but actually tired and distracted drivers. It may be possible that New Yorkers, who are notoriously stuck in a 'busy' culture, are too tired and overworked. I took this set of data and filtered on reasons for fatal collisions:
|2||Traffic Control Disregarded||124|
|4||Failure to Yield Right-of-Way||75|
With this data in mind, the Vision Zero program should be able to implement countermeasures address these pain points. Has the situation improved over the years?
Batter Up: Vision Zero's Data
To explore that question, I created 2 choropleths with a diverging colormap to represent the diffs in collisions for the years of 2013-2014 and 2014-2015. I only used these years because these were the only years where we had a full years worth of data.
As we can see, 2013-2014 looks good — we see a generally blue (decreasing) trend. However, the total population of collisions increased slightly in that period, going from 203,689 collisions in 2013 to 205,929 collisions in 2014 (a 1.10% increase). While there are still some pain points, many areas do seem to generally be improving, which is good for NY.
The next map, representing 2014-2015, is concerning though, as all of NYC looks like it's in the red. This is particularly concerning as this is the year when Vision Zero was kicked off. The total count of collisions increased somewhat drastically in this period relative to last year, going from 205,929 in 2014 to 217,539 in 2015 (a 5.64% increase).
I speculated on the reasons for this increase and thought that it may be possible that Vision Zero put more emphasis on collecting better collision data. As a result, collision data is more meticulously captured and hence an increase in the number of collisions. It's also possible that inevitably, an increasing number of people in NYC may account for an increasing number of collisions. Objectively looking at the numbers, one may presume that Vision Zero has been failing since its implementation.
However, if you think about the mission statement for Vision Zero — which is to reduce fatalities — then Vision Zero may be working in that regard. I aggregated the data by fatal accidents by year and saw a decreasing trend:
|Year||Count of Fatalities|
NYC may be becoming more densely populated and may inevitably have more crashes (due to human error), but at least those crashes can be less tragic . Using this set of data, I wanted to see where most of the reductions in fatalities came from.
Fatalities by Borough
To do this, I looked at the fatalities and grouped the data by borough over the same 2 year period. Here we can see some interesting trends forming from these graphs.
Wow! The trends per borough seem all over the place — Manhattan and Queens have seen some decreases in fatalities, but Brooklyn has been stagnant at 67 for the 3 years, Staten Island has actually been increasing, and the Bronx has somewhat of an erratic trend. This chart seems to indicate that there are limited resources in the Vision Zero program and certain areas are getting more benefits while others are having a blind eye turned on them. Since this program is still young, this may be useful in guiding the decisions for reallocating resources to certain areas.
Conclusion and Next Steps
Although vehicular collisions have been increasing over the past couple of years, the number of fatalities has been decreasing. If we look at the mission statement for Vision Zero, then in that regard the program is currently working. However, it appears that only certain areas have benefitted from the Vision Zero and more work and resources need to be allocated to address some problem areas.
Since this is an actively updating data set, I would definitely be interested to see if future data points continues this trend of certain boroughs benefitting more. I would also want to see if the areas that are being neglected are correlated to areas which are poor and have bad infrastructure. Finally, I would want to create a KPI report/dashboard comparing NYC's implementation of Vision Zero vs. other cities implementing a Vision Zero program. Using that, I would want to see if New York's stats are normal for metropolitan areas.