Data Analysis on Vehicular Collisions within NYC

Posted on Oct 23, 2016
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Introduction

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?

Data Analysis on Vehicular Collisions within NYC

Is New York City as bad as this?

Data Background

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:

Data Analysis on Vehicular Collisions within NYC

Visually inspecting this choropleth, we can see that the main pain points in NYC are:

  1. Heavy traffic density/population neighborhoods and hip neighborhoods like:
    1. Midtown (not surprisingly!)
    2. DUMBO
    3. Long Island City
  2. Poor neighborhoods:
    1. 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.

Data Analysis on Vehicular Collisions within NYC

Looks fun in the morning doesn't it?

Time

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:

crashes_by_hour

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.

Contributing Factors

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:

Number Reason Count
1 Unspecified 500826
2 Driver Inattention/Distraction 106757
3 Fatigued/Drowsy 48153
4 Failure to Yield Right-of-Way 36776
5 Other Vehicular 27953

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:

Number Reason Count
1 Unspecified 536
2 Traffic Control Disregarded 124
3 Driver Inattention/Distraction 95
4 Failure to Yield Right-of-Way 75
5 Passenger Distraction 52

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

2013-2014

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.

2013-2014 2014-2015

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.

2014-2015

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
2013 297
2014 262
2015 243

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.

fatalities_by_borough

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.

About Author

Regan Yee

Regan is an aspiring data scientist who comes from a computer science background. He obtained his Bachelors degree from Northeastern University in Computer Science. After graduating, Regan worked at State Street Global Advisors on business intelligence systems, performing...
View all posts by Regan Yee >

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI