Introduction

Global Warming is without a doubt an open topic of discussion. Although there is strong debate among scientists on the causes of global temperature rise such as increase in carbon dioxide due to fossil fuels or non CO2 greenhouse gases, we can certainly use data to perform analysis and take part in this vital conversation. Despite the trend, it is also quite alarming as the temperature rise has been accelerating. I have used data from the World Bank Climate, the EPA (Environmental Protection Agency), the NOAA (National Centers for Environmental Information), and CDIAC (Carbon Dioxide Information Analysis Center) to see how much of a strong correlation if any is there between carbon dioxide emissions and temperature rise with global warming using historical data since the 1900s. It seems the more media attention global warming receives, the more polarized our nation becomes. I am hoping that this project will provide some analysis so that individuals can make more rational decisions, take actionable steps and also inform/educate others.

#Load necessary libraries
library(stringr)
library(tidyr)
library(forcats)
library(dplyr)
library(ggplot2)
library(ggmap)
library(plotly)
library(DT)
library(tm)
library(RColorBrewer)
library(devtools)
library(syuzhet)
library(psych)
library(rnoaa)
library(scales)
library(doMC)
library(plyr)
library(rWBclimate)

World Bank Climate data

Using the annual data obtained from the World Bank climate data, I was able to extract data from countries. The expected temperature anomaly for each 20 year period over a baseline control period of 1961-2000 is shown. As one can see, the northern most nations: Russia, USA and Cananda have the largest anomaly while Belize has the smallest being one of the most equatorial nations.

# obtaining the data
nationlist <- c("CAN", "USA", "MEX", "BLZ", "ARG", "IND", "RUS")
nationdata <- get_model_temp(nationlist, "annualanom", 2010, 2100)

# Subset data 
nationdatas <- nationdata[nationdata$gcm == "bccr_bcm2_0", ]

# Exclude A2 scenario
nationdatas <- subset(nationdatas, nationdatas$scenario != "a2")

# visualize the data
ggplot(nationdatas, aes(x = fromYear, y = data, group = locator, colour = locator)) +
    geom_point() + geom_path() + ylab("Temperature anomaly over baseline") +
    theme_bw(base_size = 20)

Let’s dig deeper and look at the United States

#Read in csv file  from github
US_temp <- read.csv("https://raw.githubusercontent.com/rickidonsingh/MSDS/master/Data%20607%20Data%20Acquisition%20and%20Management/Projects/Final_Project/US_temp.csv", stringsAsFactors = FALSE)
head(US_temp, 10)
##    State     Lat     Long Change.in.95.percent.Days
## 1     AL 31.0583 -87.0550                 -12.64706
## 2     AL 30.5467 -87.8808                   0.00000
## 3     AL 32.8347 -88.1342                  16.59491
## 4     AL 32.7019 -87.5814                   0.00000
## 5     AL 31.8814 -86.2503                   0.00000
## 6     AL 34.1736 -86.8133                   0.00000
## 7     AL 34.6736 -86.0536                   0.00000
## 8     AL 32.4111 -87.0144                   0.00000
## 9     AL 33.4164 -86.1350                   0.00000
## 10    AL 31.9172 -87.7347                   0.00000
tail(US_temp, 10)
##      State     Lat      Long Change.in.95.percent.Days
## 1091    NC 35.2325  -75.6219                  14.88410
## 1092    FL 30.3975  -84.3289                  29.45908
## 1093    AL 33.2119  -87.6161                   0.00000
## 1094    KY 36.9647  -86.4239                   0.00000
## 1095    OK 34.9894  -99.0525                   0.00000
## 1096    MT 48.2138 -106.6213                   0.00000
## 1097    OR 46.1569 -123.8825                   0.00000
## 1098    NY 40.7789  -73.9692                   0.00000
## 1099    NY 43.1450  -75.3839                   0.00000
## 1100    MN 46.9006  -95.0678                   0.00000
#Display data
hot <- US_temp %>% group_by(Change.in.95.percent.Days) %>% filter(all(Change.in.95.percent.Days>=10))

This data pertains to states that have extremely high temperatures within the warmest 5 percent of measurements from 1948 till 2015. This above normal temperature relates to states having temperature higher than the 95th percentile since 1948.

High Level statistics for “change in 95% days”

describe(hot$Change.in.95.percent.Days)
##    vars   n  mean   sd median trimmed  mad   min   max range skew kurtosis
## X1    1 130 18.04 7.97  15.52   16.56 5.39 10.11 53.98 43.87  1.9     4.07
##     se
## X1 0.7

Rise in annual average temperatures in the United States

#used fct_reorder from forcats 
hot %>%
  mutate(name = fct_reorder(State, Change.in.95.percent.Days)) %>%
  ggplot( aes(x=State, y=Change.in.95.percent.Days)) +
    geom_bar(stat="identity", color ="grey") +
    coord_flip()

The map is displaying the high temperatures in the 95th percentile spread across indicating global warming and next we’ll look at one of the greenhouse gases that is diretly related.

#Used get_map function to download map as an image
usmap <- get_map(location = "United Staes", zoom = 4, maptype = "terrain", source = "google", color = 'color')
#gglpot handles the graphics with the geographical coordinates
ggmap(usmap) + geom_point(
        aes(x=Long, y=Lat, show_guide = TRUE, colour=Change.in.95.percent.Days), 
        data=hot, alpha=.8, na.rm = T)  + 
        scale_color_gradient(low="blue", high="blue")

Temperature changes in the US

What about Greenhouse Gases?

How much of a role does greenhouse gases play in this phenomenon? It turns out that over the years, CO2 emissions are only increasing on planet earth by what else but human intervention. So, as you can see from the first visual- the Solar radiation passes through the atmosphere and the earth warms and emits infrared radiation, and this infrared radiation is absorbed by greenhouse gases and re-radiated in all directions. Greenhouse gases such as Carbon Dioxide act as a blanket, and trap some of Earth’s heat. Burning fossil fuels adds to the extra greenhouse gases to the atmosphere. And so, these extra gases trap more heat, thus causing global warming. So to look into this, I used data from the ‘Carbon Dioxide Information Analysis Center.’

A steep rise in Carbon Dioxide emissions

Data from the ‘Carbon Dioxide Information Analysis Center’ was used. 392 billion metric tonnes of carbon have been released to the atmosphere from the consumption of fossil fuels and cement production. So clearly, from the below data and visual the strong rise in CO2 emissions over the years contributes heavily to the rise in temperatures thus promoting global warming.

#Read in csv file from github
ffuel <- read.csv("https://raw.githubusercontent.com/rickidonsingh/MSDS/master/Data%20607%20Data%20Acquisition%20and%20Management/Projects/Final_Project/FossilFuel.csv", stringsAsFactors = FALSE)

#create ffuel2 data frame
ffuel2 <- data.frame(ffuel$Year, ffuel$Total.carbon.emissions.from.fossil.fuel.consumption.and.cement.production..million.metric.tons.of.C.)

#removed other columns and only kept "year" and "emissions" for analysis
ffuel2 <- ffuel2[-c(1:240),]
names(ffuel2) <- c("year", "emissions")

#Take a quick look at head and tail for ffuel2 data
head(ffuel2)
##     year emissions
## 241 1990      6096
## 242 1991      6171
## 243 1992      6110
## 244 1993      6104
## 245 1994      6208
## 246 1995      6344
tail(ffuel2)
##     year emissions
## 259 2008      8738
## 260 2009      8641
## 261 2010      9137
## 262 2011      9508
## 263 2012      9671
## 264 2013      9776

CO2 emissions plot

#Displaying CO2 plot
co2plot <- ggplot(ffuel2, aes(year, emissions, group = 1,  color=emissions)) +
         geom_bar(stat="identity", width=.5, fill="tomato3") + 
         geom_point(size = 1) +
         labs(x = "year", y = "CO2 emissions", 
         title = "") +
         theme(axis.text.x = element_text(angle = 90, hjust = 1), axis.text=element_text(size=6))
ggplotly(co2plot)

Conclusion

From the World Bank Climate analysis along with other data sources, it appears that a clear temperature increase is in place around the world. The strong rise in Carbon Dioxide emissions created by human activity and the rapid increase in warmer temperatures globally and very strongly in the United States are contributing to global warming. There are certainly other factors which also carry an impact on our climate which I would love to take into account and further research in the near future. Despite the strong polarization of our nation on climate change, we should educate ourselves and have a positive impact to increase the longevity of our home, planet earth.

Future Improvements

As a way to strengthen my conclusions further, it would be interesting to use data sets that provide temperature changes by season for a specific area and compare season analysis to see if all the seasons show the same curve or not as a next step.