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

Your email address will not be published. Required fields are marked *

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags