ECONOMIC AND HEALTH IMPACT OF CLIMATIC EVENTS IN THE US

SYNOPSIS

Through this project, we will analyze the impact of climatic events in the US on the economy and health of the American population. The data we will analyze has been downloaded from the US National Oceanic and Atmospheric Administration’s (NOAA) storm database. This database contains the majority of climatic events in the US, along with estimates of the health and economic parameters impacted when the event occurred. The aim of our analysis is to determine which climatic events have the greatest health impact in the US and which events have the greatest economic impact in the US. To meet our objective, we will work with these health (FATALITIES, INJURIES) and economic (PROPDMG, CROPDMG) variables to find out which climatic events have the greatest health and economic impact in the US. Our analysis on Fatalities and Injuries conclude that Tornado is the most harmful event in respect to the US health (population). On the other hand, based on the Property and Cost damage, we conclude that Flood has the greatest economic consequences to the US

INTRODUCTION

Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severe events can result in fatalities, injuries, and property damage, and preventing such outcomes to the extent possible is a key concern.

This project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. This database tracks characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, and property damage.

DATA

The data for this assignment come in the form of a comma-separated-value file compressed via the bzip2 algorithm to reduce its size. You can download the file from the course web site:

There is also some documentation of the database available. Here you will find how some of the variables are constructed/defined.

The events in the database start in the year 1950 and end in November 2011. In the earlier years of the database there are generally fewer events recorded, most likely due to a lack of good records. More recent years should be considered more complete.

DATA PROCESSING

  1. Loading the data to R

Load the package required for the analysis.

library(tidyverse)

Download the database via the links above.

url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(url, destfile = "./storm_data.bz2")

Once the data has been uploaded to our directory, we’ll use the “read.csv()” function to load the data in “bz2” format.

storm.data <- read.csv("storm_data.bz2", header = TRUE, sep = ",")
  1. First overview of the Data

Now the given dataset is in our environment. Let’s have a look at the dataset dimension.

dim(storm.data)
## [1] 902297     37

Then the different columns of the dataset.

colnames(storm.data)
##  [1] "STATE__"    "BGN_DATE"   "BGN_TIME"   "TIME_ZONE"  "COUNTY"    
##  [6] "COUNTYNAME" "STATE"      "EVTYPE"     "BGN_RANGE"  "BGN_AZI"   
## [11] "BGN_LOCATI" "END_DATE"   "END_TIME"   "COUNTY_END" "COUNTYENDN"
## [16] "END_RANGE"  "END_AZI"    "END_LOCATI" "LENGTH"     "WIDTH"     
## [21] "F"          "MAG"        "FATALITIES" "INJURIES"   "PROPDMG"   
## [26] "PROPDMGEXP" "CROPDMG"    "CROPDMGEXP" "WFO"        "STATEOFFIC"
## [31] "ZONENAMES"  "LATITUDE"   "LONGITUDE"  "LATITUDE_E" "LONGITUDE_"
## [36] "REMARKS"    "REFNUM"

We can see that the data consists of 37 variables. We are only interested in the event type (“EVTYPE”), health parameters (“FATALITIES”, “INJURIES”) and economic parameters (“PROPDMG”, “CROPDMG”).
Next, we’ll select the columns we’re interested in.

dt.int <- storm.data %>% 
        select("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")

Now we have the data we need. Let’s take a look at their structure to find out more about their content.

str(dt.int)
## 'data.frame':    902297 obs. of  7 variables:
##  $ EVTYPE    : chr  "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
##  $ FATALITIES: num  0 0 0 0 0 0 0 0 1 0 ...
##  $ INJURIES  : num  15 0 2 2 2 6 1 0 14 0 ...
##  $ PROPDMG   : num  25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
##  $ PROPDMGEXP: chr  "K" "K" "K" "K" ...
##  $ CROPDMG   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ CROPDMGEXP: chr  "" "" "" "" ...

We can see that the economic costs are not yet complete, as the exponents are expressed in characters that would be difficult to calculate.

  1. Convert character exponents to their numerical values

Next, we’ll look at the different exponent values on PROPDMGEXP and CROPDMGEXP.

exp <- unlist(c(unique(dt.int$PROPDMGEXP), unique(dt.int$CROPDMGEXP)))
print(exp)
##  [1] "K" "M" ""  "B" "m" "+" "0" "5" "6" "?" "4" "2" "3" "h" "7" "H" "-" "1" "8"
## [20] ""  "M" "K" "m" "B" "?" "0" "k" "2"
for (caractere in exp ) {
        if (caractere == "K") { # to Mille
                dt.int[, 5] <-  gsub(caractere, 1000, dt.int[,5])
                dt.int[, 7] <-  gsub(caractere, 1000, dt.int[,7])
        } else if ( caractere == "M"){ # to Million
                dt.int[, 5] <-  gsub(caractere, 1000000, dt.int[,5])
                dt.int[, 7] <-  gsub(caractere, 1000000, dt.int[,7])
        } else if ( caractere == "m"){ # error so 0
                dt.int[, 5] <-  gsub(caractere, 0, dt.int[,5])
                dt.int[, 7] <-  gsub(caractere, 0, dt.int[,7])
        } else if ( caractere == "B"){ # to billions
                dt.int[, 5] <-  gsub(caractere, 1000000000, dt.int[,5])
                dt.int[, 7] <-  gsub(caractere, 1000000000, dt.int[,7])
        } else if ( caractere == "h"){ # error so 0
                dt.int[, 5] <-  gsub(caractere, 0, dt.int[,5])
        } else if ( caractere == "H"){ # error so 0
                dt.int[, 5] <-  gsub(caractere, 0, dt.int[,5])
        } else if ( caractere == "h"){ # error so 0
                dt.int[, 5] <-  gsub(caractere, 0, dt.int[,5])
        } else if ( caractere == "k"){ # error so 0
                dt.int[, 7] <-  gsub(caractere, 0, dt.int[,7])
        } else {
                
        }
}

Now we’ll convert them to numeric. Note that other non-numeric values will be evaluated as NA.

dt.int[5] <- as.numeric(dt.int$PROPDMGEXP)
dt.int[7] <- as.numeric(dt.int$CROPDMGEXP)

Now, we’ll replace the NA by 0.

dt.int[5] <- replace_na(dt.int$PROPDMGEXP, 0)
dt.int[7] <- replace_na(dt.int$CROPDMGEXP, 0)

Let’s take a look at the result now.

head(dt.int)
##    EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## 1 TORNADO          0       15    25.0       1000       0          0
## 2 TORNADO          0        0     2.5       1000       0          0
## 3 TORNADO          0        2    25.0       1000       0          0
## 4 TORNADO          0        2     2.5       1000       0          0
## 5 TORNADO          0        2     2.5       1000       0          0
## 6 TORNADO          0        6     2.5       1000       0          0
  1. Create a column containing the real cost per damage
dt.int <- dt.int %>% 
        mutate(prop.cost = PROPDMG * PROPDMGEXP) %>% # PROPDMG Cost
        mutate(crop.cost = CROPDMG * CROPDMGEXP)  # CROPDMG Cost

ANALYSIS

  1. Estimate health impact

To find out the impact of different events on health, for each event we will calculate (“sum”) its total impact on fatality, injury and their sums. From this, we’ll take the first 15 events with the greatest impact on health.

  • For FATALITIES
pop.fat <- dt.int %>% 
        group_by(EVTYPE) %>% 
        summarise(FATALITIES = sum(FATALITIES)) %>% 
        arrange(desc(FATALITIES))
  • For INJURIES
pop.inj <- dt.int %>% 
        group_by(EVTYPE) %>% 
        summarise(INJURIES = sum(INJURIES)) %>% 
        arrange(desc(INJURIES))
  • The sum of FATALITIES and INJURIES
pop.heal <- right_join(pop.fat, pop.inj, by = "EVTYPE") %>% 
        mutate(HEALTH_IMPACT = FATALITIES + INJURIES) %>% 
        arrange(desc(HEALTH_IMPACT)) %>% 
        top_n(15, HEALTH_IMPACT)
print(pop.heal)
## # A tibble: 15 × 4
##    EVTYPE            FATALITIES INJURIES HEALTH_IMPACT
##    <chr>                  <dbl>    <dbl>         <dbl>
##  1 TORNADO                 5633    91346         96979
##  2 EXCESSIVE HEAT          1903     6525          8428
##  3 TSTM WIND                504     6957          7461
##  4 FLOOD                    470     6789          7259
##  5 LIGHTNING                816     5230          6046
##  6 HEAT                     937     2100          3037
##  7 FLASH FLOOD              978     1777          2755
##  8 ICE STORM                 89     1975          2064
##  9 THUNDERSTORM WIND        133     1488          1621
## 10 WINTER STORM             206     1321          1527
## 11 HIGH WIND                248     1137          1385
## 12 HAIL                      15     1361          1376
## 13 HURRICANE/TYPHOON         64     1275          1339
## 14 HEAVY SNOW               127     1021          1148
## 15 WILDFIRE                  75      911           986
  1. Estimate the economic impact

To find out the impact of different events on the US economy, for each event we’ll calculate (“sum”) the total cost of damage caused by each type of event. From this, we’ll take the first 15 events with the highest economic cost.

  • For PROPERTIES DAMAGE
eco.prop <- dt.int %>% 
        group_by(EVTYPE) %>% 
        summarise(PROPCOST = sum(prop.cost)) %>% 
        arrange(desc(PROPCOST))
  • For CROP DAMAGE
eco.crop <- dt.int %>% 
        group_by(EVTYPE) %>% 
        summarise(CROPCOST = sum(crop.cost)) %>% 
        arrange(desc(CROPCOST))
  • The sum of both
eco.tot <- right_join(eco.crop, eco.prop, by = "EVTYPE") %>% 
        mutate(TOTAL.COST = CROPCOST + PROPCOST) %>% 
        arrange(desc(TOTAL.COST)) %>% 
        top_n(15, TOTAL.COST)
print(eco.tot)
## # A tibble: 15 × 4
##    EVTYPE               CROPCOST      PROPCOST    TOTAL.COST
##    <chr>                   <dbl>         <dbl>         <dbl>
##  1 FLOOD              5661968450 144657709800  150319678250 
##  2 HURRICANE/TYPHOON  2607872800  69305840000   71913712800 
##  3 TORNADO             414953110  56925660991   57340614101 
##  4 STORM SURGE              5000  43323536000   43323541000 
##  5 HAIL               3025537450  15727366870   18752904320 
##  6 FLASH FLOOD        1421317100  16140812087.  17562129187.
##  7 DROUGHT           13972566000   1046106000   15018672000 
##  8 HURRICANE          2741910000  11868319010   14610229010 
##  9 RIVER FLOOD        5029459000   5118945500   10148404500 
## 10 ICE STORM          5022113500   3944927810    8967041310 
## 11 TROPICAL STORM      678346000   7703890550    8382236550 
## 12 WINTER STORM         26944000   6688497250    6715441250 
## 13 HIGH WIND           638571300   5270046260    5908617560 
## 14 WILDFIRE            295472800   4765114000    5060586800 
## 15 TSTM WIND           554007350   4484928440    5038935790

RESULTS

  1. Question 1 : Events that are most harmful with respect to population health

For a better presentation of the results, we’re going to make a barplot to show the top 15 events with a strong impact on the health of the American population.

# reshaping data
health <- pivot_longer(pop.heal, cols = c(2:4), names_to = "Health Damage", values_to = "Value") 
# Create barplot

plot.health <- ggplot (health, aes(x = factor(EVTYPE, levels = unlist(unique(pop.heal$EVTYPE))), y = Value))
plot.health + geom_bar(stat = "identity", aes(fill = health$`Health Damage` ), position = "dodge", just = 0.5, color = "white") +
        theme(axis.text.x = element_text(angle=45, hjust=1)) +
        labs(title = "Top 15 climatic events in the US and their impact on population health", 
             x = "Events Type", y = "Number of victims", fill = "Health Damage Type")

  1. Question 2: Events that have the greatest economic consequences

For a better presentation of the results, we’re going to make a barplot to show the top 15 events with strong economic repercussions.

# reshaping data
eco.long <- pivot_longer(eco.tot, cols = c(2:4), names_to = "COST TYPE", values_to = "COST")
# Plotting
plot.eco <- ggplot (eco.long, aes(x = factor(EVTYPE, levels = unlist(unique(eco.tot$EVTYPE))), y = COST/1000000000))
plot.eco + geom_bar(stat = "identity", aes(fill = eco.long$`COST TYPE`), position = "dodge", color = "white") +
        theme(axis.text.x = element_text(angle=45, hjust=1)) +
        labs(title = "Top 15 US climate events and their economic fallout", 
             x = "Events Type", y = "Cost by damage (in Billions USD)", fill = "Cost Damage Type")