NYC Leading Causes of Death

Posted on Oct 29, 2017

Contributed by Joseph Mata. He currently in the NYC Data Science Academy Remote Bootcamp program taking place between September 18 to April 1st, 2018. This is based on his first project- Shiny(due on the 4th week of the program).

Being a yoga teacher, I am a firm believer that health is determined by a person’s individual behaviors. However, factors like ethnicity and sex are cannot be chosen and impact the probability of death from a certain cause.

The goal of the project was to determine what trends exist in the leading causes of death when looked through the lens of ethnicity and sex. I decided to focus on the four major ethnicities (White, Hispanic, Black, and Asian) that reside in my hometown, New York City. To conduct my research, I used data New York City Leading Causes of Death which consisted of 708 observations and 7 variables.

The Process

Using dplyr, I deleted any information pertaining to ethnicities that were not clearly defined by race ("Other Race/ Ethnicity", and "Not Stated/Unknown"). I then renamed the factors under Ethnicity and Sex to simpler terms. Afterward, the number of deaths and death rates were transformed from character strings to numeric values.


In the seven-year span, 418,760 people died. Of the total, 49.3% of them were White, 26.5% were Black, 17.9% were Hispanic and 6.29% were Asian. In regards to sex, 51.2% of deaths were women. Interestingly, more White women died than all Asian, Black, and Hispanic women combined.

I decided to use a box plot to determine the leading cause of death regardless of sex or race. The plot shows it is heart disease followed by cancer which makes up for 59.7% of deaths. Also, here we notice three outliers in heart disease which represent White female deaths from 2007-2009.

Diving deeper, the data suggest that on average more White men and women die from cancer and heart disease than any other race.

Globally we can see that the amount of deaths ascribed to heart disease has been declining while that of cancer relatively remained the same.

However, that is not the case when we look at specific races. For example, for Hispanics, heart disease does also declines from year to year. However, conversely, cancer increases besides having a dip in 2010.

There are many ways to analyze the data. To highlight trends both globally and categorically I used R. Shiny, an interactive web application in which the user can create a live analysis.  Here one is able to input ethnicity, gender, and year to create a side-by-side comparison between two types of people.


The leading cause of death regardless of race, sex, or year is heart disease followed by cancer. Though death by heart disease has steadily been decreasing in NYC in general, for some ethnicities it is the exact opposite. For example, from 2007-2009, most Asians regardless of sex have died from heart disease. However, in 2010, cancer took the lead and remained the number one cause of death for the next 4 years.

About Author

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws 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 Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R 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 Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp