THE EFFECT OF CLIMATIC EVENTS IN THE US: HEALTH AND ECONOMIC CONSEQUENCES

SYNOPSIS

Severe climatic events such as tornados or typhoons are one of the biggest concerns for the people living in the US, as they can inflict huge economic and personal damage. In this report, the aim is to analyse which of those climatic events are more harmful, regarding human health and regarding economic damage. To do it, we use data from the US National Weather Service. In our findings, we observe that tornados are the worst events in terms of human health, causing the higher number of casualties and injuries, whereas floods are the worst events in terms of economic damage.

LOADING THE DATA

Before starting, it is necessary to load the packages dplyr, knitr and ggplot2 on R:

library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(knitr)
library(ggplot2)

Data (https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2) IS avaible on-line as well as details on this data (https://d396qusza40orc.cloudfront.net/repdata%2Fpeer2_doc%2Fpd01016005curr.pdf).

You can either download the file directly to R, or download on the PC and then load it to R. Here, I apply the second option. So first, use the link I have provided before, and then put the file in the same directory as the working directory in R.

data <- read.csv("C:/Users/ftorrent/Desktop/Data Science Track1/Coursera/Reproducible Research/Assignment 2/repdata-data-StormData.csv/repdata-data-StormData.csv")
dim(data)
## [1] 902297     37

As we can observe, there are 902297 observations and 37 variables.

str(data)
## 'data.frame':    902297 obs. of  37 variables:
##  $ STATE__   : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ BGN_DATE  : Factor w/ 16335 levels "1/1/1966 0:00:00",..: 6523 6523 4242 11116 2224 2224 2260 383 3980 3980 ...
##  $ BGN_TIME  : Factor w/ 3608 levels "00:00:00 AM",..: 272 287 2705 1683 2584 3186 242 1683 3186 3186 ...
##  $ TIME_ZONE : Factor w/ 22 levels "ADT","AKS","AST",..: 7 7 7 7 7 7 7 7 7 7 ...
##  $ COUNTY    : num  97 3 57 89 43 77 9 123 125 57 ...
##  $ COUNTYNAME: Factor w/ 29601 levels "","5NM E OF MACKINAC BRIDGE TO PRESQUE ISLE LT MI",..: 13513 1873 4598 10592 4372 10094 1973 23873 24418 4598 ...
##  $ STATE     : Factor w/ 72 levels "AK","AL","AM",..: 2 2 2 2 2 2 2 2 2 2 ...
##  $ EVTYPE    : Factor w/ 985 levels "   HIGH SURF ADVISORY",..: 834 834 834 834 834 834 834 834 834 834 ...
##  $ BGN_RANGE : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ BGN_AZI   : Factor w/ 35 levels "","  N"," NW",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ BGN_LOCATI: Factor w/ 54429 levels "","- 1 N Albion",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ END_DATE  : Factor w/ 6663 levels "","1/1/1993 0:00:00",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ END_TIME  : Factor w/ 3647 levels ""," 0900CST",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ COUNTY_END: num  0 0 0 0 0 0 0 0 0 0 ...
##  $ COUNTYENDN: logi  NA NA NA NA NA NA ...
##  $ END_RANGE : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ END_AZI   : Factor w/ 24 levels "","E","ENE","ESE",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ END_LOCATI: Factor w/ 34506 levels "","- .5 NNW",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ LENGTH    : num  14 2 0.1 0 0 1.5 1.5 0 3.3 2.3 ...
##  $ WIDTH     : num  100 150 123 100 150 177 33 33 100 100 ...
##  $ F         : int  3 2 2 2 2 2 2 1 3 3 ...
##  $ MAG       : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ 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: Factor w/ 19 levels "","-","?","+",..: 17 17 17 17 17 17 17 17 17 17 ...
##  $ CROPDMG   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ CROPDMGEXP: Factor w/ 9 levels "","?","0","2",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ WFO       : Factor w/ 542 levels ""," CI","$AC",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ STATEOFFIC: Factor w/ 250 levels "","ALABAMA, Central",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ ZONENAMES : Factor w/ 25112 levels "","                                                                                                                               "| __truncated__,..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ LATITUDE  : num  3040 3042 3340 3458 3412 ...
##  $ LONGITUDE : num  8812 8755 8742 8626 8642 ...
##  $ LATITUDE_E: num  3051 0 0 0 0 ...
##  $ LONGITUDE_: num  8806 0 0 0 0 ...
##  $ REMARKS   : Factor w/ 436774 levels "","-2 at Deer Park\n",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ REFNUM    : num  1 2 3 4 5 6 7 8 9 10 ...

Here we have a list of the variables in our dataset.

PROCESSING THE DATA

As we can recall, there are two different questions to answer in this assignment:

  1. Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health?

  2. Across the United States, which types of events have the greatest economic consequences?

So, according to those questions, we can clean the dataset we have, so it gets smaller and faster to compute. Therefore, for this analysis we will use (and keep) the variables:

  • State (STATE)
  • Date (BGN_DATE)
  • Type of event (EVTYPE)
  • Number of fatalities (FATALITIES)
  • Number of injuries (INJURIES)
  • Property damage (PROPDMG)
  • Property damage units, either K or M (PROPDMGEXP)
  • Crop damage (CROPDMG)
  • Crop damage units, either K or M (CROPDMGEXP)

The fatalities and injuries variables inform us about the health damage caused by the event, whereas the last four variables inform about the material damage caused.

data<-select(data, STATE, BGN_DATE, EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)

Now, let’s format the variables on the dataset. First, we set the date variable on its proper category:

data$date = as.Date(data$BGN_DATE,  format = "%m/%d/%Y")

Then we also want to merge the PROPDMG and PROPDMGEXP variable and the CROPDMG and CROPDMGEXP, so we get only one complete number for each observation. By using the levels formula, we can see how many different “measures” are there in PROPDMGEXP and CROPDMGEXP:

levels(data$CROPDMGEXP)
## [1] ""  "?" "0" "2" "B" "k" "K" "m" "M"
levels(data$PROPDMGEXP)
##  [1] ""  "-" "?" "+" "0" "1" "2" "3" "4" "5" "6" "7" "8" "B" "h" "H" "K"
## [18] "m" "M"

Therefore, we have to merge this “units” with the numbers provided in PROPDMG and CROPDMG:

data$PROPDMGEXP<- as.character(data$PROPDMGEXP)

data$propdamagemultiplier<-1
data[data$PROPDMGEXP == "H", ]$propdamagemultiplier <- 100
data[data$PROPDMGEXP == "K", ]$propdamagemultiplier <- 1000
data[data$PROPDMGEXP == "M", ]$propdamagemultiplier <- 1000000
data[data$PROPDMGEXP == "B", ]$propdamagemultiplier <- 1000000000
data[data$PROPDMGEXP == "h", ]$propdamagemultiplier <- 100
data[data$PROPDMGEXP == "m", ]$propdamagemultiplier <- 1000000

data$totalpropertydamage <- data$PROPDMG*data$propdamagemultiplier


data$CROPDMGEXP<- as.character(data$CROPDMGEXP)

data$cropdamagemultiplier<-1
data[data$CROPDMGEXP == "K", ]$cropdamagemultiplier <- 1000
data[data$CROPDMGEXP == "M", ]$cropdamagemultiplier <- 1000000
data[data$CROPDMGEXP == "B", ]$cropdamagemultiplier <- 1000000000
data[data$CROPDMGEXP == "k", ]$cropdamagemultiplier <- 1000
data[data$CROPDMGEXP == "m", ]$cropdamagemultiplier <- 1000000

data$totalcropdamage <- data$CROPDMG*data$cropdamagemultiplier

I clean again the dataset, dropping the variables I won’t use for my analysis:

data<-select(data, STATE,  EVTYPE, FATALITIES, INJURIES, date, totalpropertydamage, totalcropdamage)

Now, to have a look closely to the dataset and see its completeness, we can observe which quantity of observations are there every year:

data$year <- as.integer(strftime(data$date,"%Y"))
hist(data$year, main = "N° of events per year", xlab="Year")

As we can observe,the events in the database start in the year 1950 and end in mid 2011. In the earlier years of the database there are fewer events recorded, most likely due to a lack of good records or processing information techniques. More recent years should be considered more complete. Another interpretation could be that the number of events per year have been increasing due to global warming effects or other long-term climatic issues. In 2011 the number of events drops, but this is because the dataset is incomplete on that year, therefore we should focus on the increasing pattern until 2010.

RESULTS

HARMFUL EVENTS FOR POPULATION HEALTH

There are two variables indicating population health: injuries and fatalities. As there are 985 different types of events, we select the top 15 for injuries and for fatalities:

FatilitiesByEvent<-aggregate(FATALITIES ~ EVTYPE,data=data,sum)
FatilitiesByEventSorted <- FatilitiesByEvent[order(-FatilitiesByEvent$FATALITIES),]
FatilitiesByEventTOP15<-FatilitiesByEventSorted[1:15, ]
FatilitiesByEventTOP15
##                EVTYPE FATALITIES
## 834           TORNADO       5633
## 130    EXCESSIVE HEAT       1903
## 153       FLASH FLOOD        978
## 275              HEAT        937
## 464         LIGHTNING        816
## 856         TSTM WIND        504
## 170             FLOOD        470
## 585       RIP CURRENT        368
## 359         HIGH WIND        248
## 19          AVALANCHE        224
## 972      WINTER STORM        206
## 586      RIP CURRENTS        204
## 278         HEAT WAVE        172
## 140      EXTREME COLD        160
## 760 THUNDERSTORM WIND        133
InjuriesByEvent<-aggregate(INJURIES ~ EVTYPE,data=data,sum)
InjuriesByEventSorted <- InjuriesByEvent[order(-InjuriesByEvent$INJURIES),]
InjuriesByEventTOP15<-InjuriesByEventSorted[1:15, ]
InjuriesByEventTOP15
##                EVTYPE INJURIES
## 834           TORNADO    91346
## 856         TSTM WIND     6957
## 170             FLOOD     6789
## 130    EXCESSIVE HEAT     6525
## 464         LIGHTNING     5230
## 275              HEAT     2100
## 427         ICE STORM     1975
## 153       FLASH FLOOD     1777
## 760 THUNDERSTORM WIND     1488
## 244              HAIL     1361
## 972      WINTER STORM     1321
## 411 HURRICANE/TYPHOON     1275
## 359         HIGH WIND     1137
## 310        HEAVY SNOW     1021
## 957          WILDFIRE      911

If we add those two, we can plot a graph indicating the type of event that has caused more damage, either in fatalities or in injuries:

data$populationhealth <- (data$FATALITIES + data$INJURIES)
PopulationhealthByEvent<-aggregate(populationhealth ~ EVTYPE,data=data,sum)
PopulationhealthByEventSorted <- PopulationhealthByEvent[order(-PopulationhealthByEvent$populationhealth),]
PopulationhealthByEventTOP15<-PopulationhealthByEventSorted[1:15, ]
PopulationhealthByEventTOP15
##                EVTYPE populationhealth
## 834           TORNADO            96979
## 130    EXCESSIVE HEAT             8428
## 856         TSTM WIND             7461
## 170             FLOOD             7259
## 464         LIGHTNING             6046
## 275              HEAT             3037
## 153       FLASH FLOOD             2755
## 427         ICE STORM             2064
## 760 THUNDERSTORM WIND             1621
## 972      WINTER STORM             1527
## 359         HIGH WIND             1385
## 244              HAIL             1376
## 411 HURRICANE/TYPHOON             1339
## 310        HEAVY SNOW             1148
## 957          WILDFIRE              986
barplot (height=PopulationhealthByEventTOP15$populationhealth, names.arg=PopulationhealthByEventTOP15$EVTYPE[1:15], las=2, cex.names=0.6,
         col = rainbow (15, start=0, end=0.5))
title (main = "N° of injuries and fatalities across events", line=1)
title (ylab = "Total number of Injuries and Fatalities", line=4, cex.lab=0.5)

As we can see, tornados are, by far, the worst event in terms of human health, as it accounts for more than 5500 fatalities and 90000 injuries. Following tornados, massive heart and TSTM wind are the most harmful events for human health.

ECONOMIC DAMAGES

To see the economic damages, we can add the total crop damage and the total property damage. Recall we have modified those variables before, so they become totally numeric and we can operate with them. Let’s see first the top 15 events that cause more property damage, then the top 15 that cause crop damage and finally the top 15 adding those two variables:

PropertydamageByEvent<-aggregate(totalpropertydamage ~ EVTYPE,data=data,sum)
PropertydamageByEventByEventSorted <- PropertydamageByEvent[order(-PropertydamageByEvent$totalpropertydamage),]
PropertydamageByEventByEventTOP15<-PropertydamageByEventByEventSorted[1:15, ]
PropertydamageByEventByEventTOP15
##                EVTYPE totalpropertydamage
## 170             FLOOD        144657709807
## 411 HURRICANE/TYPHOON         69305840000
## 834           TORNADO         56937160779
## 670       STORM SURGE         43323536000
## 153       FLASH FLOOD         16140812067
## 244              HAIL         15732267543
## 402         HURRICANE         11868319010
## 848    TROPICAL STORM          7703890550
## 972      WINTER STORM          6688497251
## 359         HIGH WIND          5270046295
## 590       RIVER FLOOD          5118945500
## 957          WILDFIRE          4765114000
## 671  STORM SURGE/TIDE          4641188000
## 856         TSTM WIND          4484928495
## 427         ICE STORM          3944927860
CropdamageByEvent<-aggregate(totalcropdamage ~ EVTYPE,data=data,sum)
CropdamageByEventByEventSorted <- CropdamageByEvent[order(-CropdamageByEvent$totalcropdamage),]
CropdamageByEventByEventTOP15<-CropdamageByEventByEventSorted[1:15, ]
CropdamageByEventByEventTOP15
##                EVTYPE totalcropdamage
## 95            DROUGHT     13972566000
## 170             FLOOD      5661968450
## 590       RIVER FLOOD      5029459000
## 427         ICE STORM      5022113500
## 244              HAIL      3025954473
## 402         HURRICANE      2741910000
## 411 HURRICANE/TYPHOON      2607872800
## 153       FLASH FLOOD      1421317100
## 140      EXTREME COLD      1292973000
## 212      FROST/FREEZE      1094086000
## 290        HEAVY RAIN       733399800
## 848    TROPICAL STORM       678346000
## 359         HIGH WIND       638571300
## 856         TSTM WIND       554007350
## 130    EXCESSIVE HEAT       492402000

Here it is interesting to see that draughts are more than twice as harmful as floods for the crops. However, draughts don’t cause any property damage, therefore when we add property and crop damage this variable falls down the “top” harmful events.

data$totaleconomicimpact<-data$totalcropdamage+data$totalpropertydamage
TotaldamageByEvent<-aggregate(totaleconomicimpact ~ EVTYPE,data=data,sum)
TotaldamageByEventByEventSorted <- TotaldamageByEvent[order(-TotaldamageByEvent$totaleconomicimpact),]
TotaldamageByEventByEventTOP15<-TotaldamageByEventByEventSorted[1:15, ]
TotaldamageByEventByEventTOP15
##                EVTYPE totaleconomicimpact
## 170             FLOOD        150319678257
## 411 HURRICANE/TYPHOON         71913712800
## 834           TORNADO         57352114049
## 670       STORM SURGE         43323541000
## 244              HAIL         18758222016
## 153       FLASH FLOOD         17562129167
## 95            DROUGHT         15018672000
## 402         HURRICANE         14610229010
## 590       RIVER FLOOD         10148404500
## 427         ICE STORM          8967041360
## 848    TROPICAL STORM          8382236550
## 972      WINTER STORM          6715441251
## 359         HIGH WIND          5908617595
## 957          WILDFIRE          5060586800
## 856         TSTM WIND          5038935845

And we plot the graph, but before let’s transform the total amounts to billions, so it is easier to read:

TotaldamageByEventByEventTOP15$billions<-(TotaldamageByEventByEventTOP15$totaleconomicimpact)/1000000000

barplot (height=TotaldamageByEventByEventTOP15$billions, names.arg=TotaldamageByEventByEventTOP15$EVTYPE[1:15], las=2, cex.names=0.6,
         col = rainbow (15, start=0, end=0.5))
title (main = "Economic damage", line=1)
title (ylab = "Total Damage (Billions USD)", line=3, cex.lab=0.8)

So we can observe that, in economic terms, a flood is the worst thing that can happen to the US, doing twice as damage that a typhoon and almost three times the damage caused by a tornado.

CONCLUSION

In terms of human health, a tornado is the worst event, being the most harmful event that can happen in the US. When evaluating the damage caused by a climatic event in terms of economic damage, floods have caused a damage of more than 150 billion USD since 1950. Typhoons account for 70 billion damage and tornados for 60 billion economic damage in the US economy.