Is Air Pollution Preventing Skin Cancer?

Posted on Dec 16, 2018

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 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.

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.

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

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 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