CLIMATE CHANGE

Climate change refers to long-term shifts in temperatures and weather patterns. These shifts may be natural, but since the 1800s, human activities have been the main driver of climate change, primarily due to the burning of fossil fuels (like coal, oil and gas), which produces heat-trapping gases. (United Nations)

Climate change has always been a topic for generations. In this age and technology, there are news and videos, more than ever, that explain and show the impact of the so call Climate Change to the world we are living. But is Climate change real?

To say climate change is real, let us determine if, through out the years, a change in global temperatures happened. If so, Climate change is real as the forerunner of such event, the long-term shifts in temperatures, will tell us that it is happening and have caused changes in weather pattern as well.

This report limits the study of temperature changes in Antarctica - a very delicate area that if such temperature changes occur, plays a vital role in the global precedent of such weather events.

Download Raw

#Download from github repo
temp <- read.csv("https://raw.githubusercontent.com/inciladc/rfiles/main/datasets/worldtemp.csv")

Inspect Raw

## 'data.frame':    9656 obs. of  66 variables:
##  $ Area.Code   : int  2 2 2 2 2 2 2 2 2 2 ...
##  $ Area        : chr  "Afghanistan" "Afghanistan" "Afghanistan" "Afghanistan" ...
##  $ Months.Code : int  7001 7001 7002 7002 7003 7003 7004 7004 7005 7005 ...
##  $ Months      : chr  "January" "January" "February" "February" ...
##  $ Element.Code: int  7271 6078 7271 6078 7271 6078 7271 6078 7271 6078 ...
##  $ Element     : chr  "Temperature change" "Standard Deviation" "Temperature change" "Standard Deviation" ...
##  $ Unit        : chr  "°C" "°C" "°C" "°C" ...
##  $ Y1961       : num  0.777 1.95 -1.743 2.597 0.516 ...
##  $ Y1962       : num  0.062 1.95 2.465 2.597 1.336 ...
##  $ Y1963       : num  2.744 1.95 3.919 2.597 0.403 ...
##  $ Y1964       : num  -5.232 1.95 -0.202 2.597 1.659 ...
##  $ Y1965       : num  1.868 1.95 -0.096 2.597 -0.909 ...
##  $ Y1966       : num  3.629 1.95 3.397 2.597 -0.069 ...
##  $ Y1967       : num  -1.432 1.95 0.296 2.597 -0.759 ...
##  $ Y1968       : num  0.389 1.95 -2.055 2.597 0.496 ...
##  $ Y1969       : num  -2.3 1.95 -3.17 2.6 2.48 ...
##  $ Y1970       : num  0.804 1.95 1.809 2.597 -0.915 ...
##  $ Y1971       : num  -1.487 1.95 0.816 2.597 1.658 ...
##  $ Y1972       : num  -1.3 1.95 -7.72 2.6 -1.78 ...
##  $ Y1973       : num  -2.951 1.95 1.838 2.597 -0.473 ...
##  $ Y1974       : num  -1.18 1.95 -3.71 2.6 1 ...
##  $ Y1975       : num  -0.49 1.95 -1.239 2.597 -0.585 ...
##  $ Y1976       : num  2.41 1.95 -1.62 2.6 -2.82 ...
##  $ Y1977       : num  -3.014 1.95 -0.156 2.597 3.377 ...
##  $ Y1978       : num  -0.663 1.95 -0.369 2.597 -1.536 ...
##  $ Y1979       : num  1.14 1.95 1.07 2.6 -1.42 ...
##  $ Y1980       : num  -0.393 1.95 -1.222 2.597 -0.628 ...
##  $ Y1981       : num  1.72 1.95 1.09 2.6 1.17 ...
##  $ Y1982       : num  0.678 1.95 -2.101 2.597 -1.781 ...
##  $ Y1983       : num  0.524 1.95 0.46 2.597 -2.406 ...
##  $ Y1984       : num  -0.058 1.95 -4.321 2.597 1.761 ...
##  $ Y1985       : num  0.435 1.95 2.467 2.597 -0.16 ...
##  $ Y1986       : num  0.332 1.95 -0.286 2.597 -3.087 ...
##  $ Y1987       : num  2.65 1.95 1.41 2.6 1.33 ...
##  $ Y1988       : num  1.15 1.95 0.17 2.597 -0.056 ...
##  $ Y1989       : num  -1.108 1.95 -2.89 2.597 0.065 ...
##  $ Y1990       : num  0.634 1.95 -0.31 2.597 -1 ...
##  $ Y1991       : num  0.018 1.95 -1.373 2.597 -0.901 ...
##  $ Y1992       : num  0.582 1.95 -0.12 2.597 -2.22 ...
##  $ Y1993       : num  -0.821 1.95 1.414 2.597 -1.449 ...
##  $ Y1994       : num  1.09 1.95 -1.41 2.6 1.31 ...
##  $ Y1995       : num  1.297 1.95 -0.149 2.597 -1.451 ...
##  $ Y1996       : num  -0.718 1.95 0.87 2.597 -0.336 ...
##  $ Y1997       : num  1.426 1.95 0.043 2.597 -0.005 ...
##  $ Y1998       : num  0.95 1.95 -0.54 2.597 -0.576 ...
##  $ Y1999       : num  0.859 1.95 3.222 2.597 -0.217 ...
##  $ Y2000       : num  1.565 1.95 -0.901 2.597 -0.267 ...
##  $ Y2001       : num  -0.603 1.95 0.707 2.597 1.229 ...
##  $ Y2002       : num  1.606 1.95 0.985 2.597 1.949 ...
##  $ Y2003       : num  2.479 1.95 1.816 2.597 -0.158 ...
##  $ Y2004       : num  2.71 1.95 2.87 2.6 2.75 ...
##  $ Y2005       : num  0.109 1.95 -1.506 2.597 1.663 ...
##  $ Y2006       : num  -1.61 1.95 4.72 2.6 1.85 ...
##  $ Y2007       : num  0.431 1.95 1.645 2.597 -0.201 ...
##  $ Y2008       : num  -5.55 1.95 -2.33 2.6 4.17 ...
##  $ Y2009       : num  1.52 1.95 2.49 2.6 2.36 ...
##  $ Y2010       : num  3.6 1.95 1.21 2.6 3.39 ...
##  $ Y2011       : num  1.179 1.95 0.321 2.597 0.748 ...
##  $ Y2012       : num  -0.583 1.95 -3.201 2.597 -0.527 ...
##  $ Y2013       : num  1.23 1.95 1.49 2.6 2.25 ...
##  $ Y2014       : num  1.755 1.95 -3.187 2.597 -0.076 ...
##  $ Y2015       : num  1.943 1.95 2.699 2.597 -0.497 ...
##  $ Y2016       : num  3.42 1.95 2.25 2.6 2.3 ...
##  $ Y2017       : num  1.201 1.95 -0.323 2.597 0.834 ...
##  $ Y2018       : num  2 1.95 2.71 2.6 4.42 ...
##  $ Y2019       : num  2.951 1.95 0.086 2.597 0.234 ...

Change in Temperature

#store temperature data in object delta_temp
delta_temp <- temp %>% filter(Element=="Temperature change")

Area of focus Antarctica

#Choose Antarctica only for this stury
a <- delta_temp %>% filter(Area=="Antarctica")

VISUALIZE YEARLY DELTA TREND

Year by Year

Month by month

b <- a
b <- b %>%  pivot_longer(cols = c(Y1961:Y2019), names_to = "years")

b %>% filter(Months!="NA") %>% ggplot(aes(years,y=value,col=Months, group=Months, label=Months)) + geom_point()+theme(axis.text.x = element_text(angle = 90))+ geom_hline(yintercept = 0.0)

Monthly Temperature Evaluation from 1961 - 2019

ANNUAL AVERAGE CHANGE IN TEMPERATURE

#Compute mean of Years from 1961-2019
mean_peryear<- colMeans(a[,c(8:66)])
Inspect Summary of mean Temperatures per year

Plotting the Annual Mean Temperatures

PREDICTION IN 10 YEARS

Data cleaning and preparation

# store f to g
g <- f
#remove Y
j <- g %>%  mutate_at("Years", str_replace,"Y","")

#format date to years
j$Years <- format(j$Years,format="%Y")

Predict using Prophet

#setting the date and store at object ds
ds <- j$Years
ds <- format(ds, format="%m/%d/%Y")
ds <- ymd(ds, truncated = 2L)

#setting the mean temperatures and store in object y
y <- j$mean_peryear

#store both as a data frame
df_pred <- data.frame(ds,y)
#prepare prediction and store at m
m <- prophet(df_pred)
#set data frame and predict for the next 10 years
future <- make_future_dataframe(m,periods = 10, freq = "year")
forecast <- predict(m,future)

Prediction from year 2000-2019 data in 10 yrs

dyplot.prophet(m,forecast)
## Warning: `select_()` was deprecated in dplyr 0.7.0.
## Please use `select()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
summary(forecast)
##        ds                          trend        additive_terms   
##  Min.   :1961-01-01 00:00:00   Min.   :0.2999   Min.   :-0.5520  
##  1st Qu.:1978-01-01 00:00:00   1st Qu.:0.5128   1st Qu.:-0.5252  
##  Median :1995-01-01 00:00:00   Median :0.7256   Median :-0.4918  
##  Mean   :1995-01-01 03:07:49   Mean   :0.7256   Mean   :-0.5044  
##  3rd Qu.:2012-01-01 00:00:00   3rd Qu.:0.9384   3rd Qu.:-0.4518  
##  Max.   :2029-01-01 00:00:00   Max.   :1.1512   Max.   :-0.4518  
##  additive_terms_lower additive_terms_upper     yearly         yearly_lower    
##  Min.   :-0.5520      Min.   :-0.5520      Min.   :-0.5520   Min.   :-0.5520  
##  1st Qu.:-0.5252      1st Qu.:-0.5252      1st Qu.:-0.5252   1st Qu.:-0.5252  
##  Median :-0.4918      Median :-0.4918      Median :-0.4918   Median :-0.4918  
##  Mean   :-0.5044      Mean   :-0.5044      Mean   :-0.5044   Mean   :-0.5044  
##  3rd Qu.:-0.4518      3rd Qu.:-0.4518      3rd Qu.:-0.4518   3rd Qu.:-0.4518  
##  Max.   :-0.4518      Max.   :-0.4518      Max.   :-0.4518   Max.   :-0.4518  
##   yearly_upper     multiplicative_terms multiplicative_terms_lower
##  Min.   :-0.5520   Min.   :0            Min.   :0                 
##  1st Qu.:-0.5252   1st Qu.:0            1st Qu.:0                 
##  Median :-0.4918   Median :0            Median :0                 
##  Mean   :-0.5044   Mean   :0            Mean   :0                 
##  3rd Qu.:-0.4518   3rd Qu.:0            3rd Qu.:0                 
##  Max.   :-0.4518   Max.   :0            Max.   :0                 
##  multiplicative_terms_upper   yhat_lower         yhat_upper    
##  Min.   :0                  Min.   :-0.88608   Min.   :0.4482  
##  1st Qu.:0                  1st Qu.:-0.65899   1st Qu.:0.6740  
##  Median :0                  Median :-0.44804   Median :0.8884  
##  Mean   :0                  Mean   :-0.44418   Mean   :0.8903  
##  3rd Qu.:0                  3rd Qu.:-0.23905   3rd Qu.:1.1009  
##  Max.   :0                  Max.   : 0.04115   Max.   :1.3547  
##   trend_lower      trend_upper          yhat           
##  Min.   :0.2999   Min.   :0.2999   Min.   :-0.2145046  
##  1st Qu.:0.5128   1st Qu.:0.5128   1st Qu.: 0.0000123  
##  Median :0.7256   Median :0.7256   Median : 0.2212236  
##  Mean   :0.7256   Mean   :0.7256   Mean   : 0.2211403  
##  3rd Qu.:0.9384   3rd Qu.:0.9384   3rd Qu.: 0.4364788  
##  Max.   :1.1512   Max.   :1.1512   Max.   : 0.6994661

Prediction from year 2000-2019 data in 10 yrs

## Disabling weekly seasonality. Run prophet with weekly.seasonality=TRUE to override this.
## Disabling daily seasonality. Run prophet with daily.seasonality=TRUE to override this.
## n.changepoints greater than number of observations. Using 15
dyplot.prophet(m2000,forecast2k) 
summary(forecast2k)
##        ds                          trend         additive_terms   
##  Min.   :2000-01-01 00:00:00   Min.   :0.05428   Min.   :-0.3286  
##  1st Qu.:2007-04-02 06:00:00   1st Qu.:0.32514   1st Qu.:-0.2567  
##  Median :2014-07-02 12:00:00   Median :0.59600   Median : 0.1033  
##  Mean   :2014-07-02 12:00:00   Mean   :0.59600   Mean   : 0.1038  
##  3rd Qu.:2021-10-01 18:00:00   3rd Qu.:0.86686   3rd Qu.: 0.4648  
##  Max.   :2029-01-01 00:00:00   Max.   :1.13772   Max.   : 0.5371  
##  additive_terms_lower additive_terms_upper     yearly         yearly_lower    
##  Min.   :-0.3286      Min.   :-0.3286      Min.   :-0.3286   Min.   :-0.3286  
##  1st Qu.:-0.2567      1st Qu.:-0.2567      1st Qu.:-0.2567   1st Qu.:-0.2567  
##  Median : 0.1033      Median : 0.1033      Median : 0.1033   Median : 0.1033  
##  Mean   : 0.1038      Mean   : 0.1038      Mean   : 0.1038   Mean   : 0.1038  
##  3rd Qu.: 0.4648      3rd Qu.: 0.4648      3rd Qu.: 0.4648   3rd Qu.: 0.4648  
##  Max.   : 0.5371      Max.   : 0.5371      Max.   : 0.5371   Max.   : 0.5371  
##   yearly_upper     multiplicative_terms multiplicative_terms_lower
##  Min.   :-0.3286   Min.   :0            Min.   :0                 
##  1st Qu.:-0.2567   1st Qu.:0            1st Qu.:0                 
##  Median : 0.1033   Median :0            Median :0                 
##  Mean   : 0.1038   Mean   :0            Mean   :0                 
##  3rd Qu.: 0.4648   3rd Qu.:0            3rd Qu.:0                 
##  Max.   : 0.5371   Max.   :0            Max.   :0                 
##  multiplicative_terms_upper   yhat_lower         yhat_upper    
##  Min.   :0                  Min.   :-0.90018   Min.   :0.3279  
##  1st Qu.:0                  1st Qu.:-0.19194   1st Qu.:1.0100  
##  Median :0                  Median : 0.09411   Median :1.2991  
##  Mean   :0                  Mean   : 0.09157   Mean   :1.3075  
##  3rd Qu.:0                  3rd Qu.: 0.40554   3rd Qu.:1.6139  
##  Max.   :0                  Max.   : 1.04837   Max.   :2.2874  
##   trend_lower       trend_upper           yhat        
##  Min.   :0.05428   Min.   :0.05428   Min.   :-0.2743  
##  1st Qu.:0.32514   1st Qu.:0.32514   1st Qu.: 0.3886  
##  Median :0.59600   Median :0.59600   Median : 0.6993  
##  Mean   :0.59600   Mean   :0.59600   Mean   : 0.6998  
##  3rd Qu.:0.86686   3rd Qu.:0.86686   3rd Qu.: 1.0101  
##  Max.   :1.13772   Max.   :1.13772   Max.   : 1.6749