Data Study on Skin Cancer and Pollution

Posted on Dec 16, 2018
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.Data Study on Skin Cancer and Pollution

Introduction and Motivation

We all learnt that air pollution is not good for the environment or our health. However, there is a theory that despite all the bad effects, air pollution reduces the chance of being diagnosed with skin cancer. The data and scientific foundation behind this theory is that air pollutants scatter and absorb UV rays, which are a significant cause of skin cancer. So reducing the amount of UV rays that reaches us should translate into less skin cancer.

However, the fact is that air pollution contributes to the depletion of the ozone layer, and the ozone layer is our natural protection from UV radiation. Hence, it is hard to say which effect plays the dominant role.

The purpose of this project is to investigate how air pollution affects the potential skin cancer rate by examining the relationship between air quality index (AQI) and UV strength index (UV) of the major cities in USA and displaying the result in a interactive RShiny app.

Data Preparation

Four datasets are collected from different databases:

  1. AQI of US counties (2002-2014) from the United States Environmental Protection Agency (EPA);
  2. UV of US major cities (2002-2014) from;
  3. US City-County data from;
  4. The built-in US map in R package

The csv files are imported into R studio and cleaned using dplyr. In order to build an interactive US map display both AQI and UV, I merged US City-County data with the two index dataset to create a data frame with coordinates, AQI, and UV for each observation.

Shiny App Design

The app has two sections: 1. Data Visualization; 2. Data Analysis. The first section displayed the AQI and UV on an interactive US map. The second part is the exploring and presenting the relationship between the two indexes.

Data Visualization

The cleaned and merged data were projected onto a interactive US map to visualize the studying index changes over period 2002 - 2014 nationwide.

The figure shown below is the app user interface. In this example, the map presents the monthly averaged AQI of counties duringt August 2006. The color represent the magnitude of the AQI; the value of AQI increases as the shades of blue grow darker. The higher AQI indicates worse air quality and greater pollution. Note that there are gray areas in the map that denote missing values in the dataset. As can be seen from the map, the air quality in US is generally good except om the northwest region. The air pollution in this region might be due to  frequent wildfires.

Data Study on Skin Cancer and Pollution

Exhibit 1. Nationwide monthly AQI interface

The panel on the left side can navigate to the time period you are interested in. The radio button gives the user an option  to see the UV on the map too. When you click on the ‘Yes’ on the bottom, the monthly averaged UV of major cities will also be displayed, as shown in figure 2. The dots represent major cities with UV levels indicated by color; low UV is indicated by  green and high UV by red.. High UV rates correlate with strong UV radiation.

The general trend is that the closer to equator, the higher the UV. In addition to selecting your period of interest, you can also target a city in the ‘Select City’ menu. In this case, the city selected is New York City, which is highlighted in the map.  Both indexes values are displayed in the ‘Index’ box at the lower left corner.

Data Study on Skin Cancer and Pollution

Exhibit 2. Nationwide monthly AQI and UV interface

The visualization function also provides the monthly and yearly change of AQI and UV for the target city.

Exhibit 3. Barplots of indexes monthly (top) and yearly (bottom) changes

Data Analysis

The purpose of this section is the provide answer to the question we brought up at the beginning: What is the relationship between air pollution and UV radiation?

The method is to build the correlation between AQI and UV using linear regression. My app provides a flexible way to conduct it.

The figure below shows the user interface of data analysis. All you need to do is to select  the target city/cities from the ‘Select Cities’ list. Then it/they will be highlighted in the map, and the linear relationship between AQI and UV basing on data from selected city(s) will be shown in the ‘Linear Regression’ box.

Exhibit 4. Data Analysis page interface

Clicking the ‘Select All’ button uses the data of all the cities. As can be seen from the figure below, the AQI and UV shows a clear positive relationship, which indicates that the increase of air pollution enhances UV radiation.

Exhibit 5. Correlation of AQI and UV in scatter plot


My RShiny app proved to be a powerful tool for visualizing and investigating scientific research data. The result shows that the increase of the air pollution leads to stronger UV radiation, which results in higher risk of skin cancer. Accordingly, the theory that increasing air pollution can result in reduced UV radiation and the benefit of lower risk of skin cancer should be rejected.

About Author

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