The impact of severe weather events on public health and economy in the United States

Synopsis

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.

Basic Settings Environment

library(R.utils)
## Loading required package: R.oo
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.2 (2022-06-13 22:00:14 UTC) successfully loaded. See ?R.methodsS3 for help.
## R.oo v1.25.0 (2022-06-12 02:20:02 UTC) successfully loaded. See ?R.oo for help.
## 
## Attaching package: 'R.oo'
## The following object is masked from 'package:R.methodsS3':
## 
##     throw
## The following objects are masked from 'package:methods':
## 
##     getClasses, getMethods
## The following objects are masked from 'package:base':
## 
##     attach, detach, load, save
## R.utils v2.12.3 (2023-11-18 01:00:02 UTC) successfully loaded. See ?R.utils for help.
## 
## Attaching package: 'R.utils'
## The following object is masked from 'package:utils':
## 
##     timestamp
## The following objects are masked from 'package:base':
## 
##     cat, commandArgs, getOption, isOpen, nullfile, parse, warnings
library(plyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
library(rmarkdown)
library(knitr)
library(ggpubr)
## 
## Attaching package: 'ggpubr'
## The following object is masked from 'package:plyr':
## 
##     mutate
options(scipen = 1) #disables scientific notation for numbers

Data Processing

First, we download the data file from the website and unzip it.

download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", "StormData.csv.bz2")
bunzip2("stormdata.csv.bz2", overwrite = TRUE, remove = FALSE)

Then, we read the generated csv file.

storm <- read.csv("stormdata.csv", sep = ",")

Let’s see what the dimensions of the data set are.

dim(storm)
## [1] 902297     37

And take a look at the different variables in the data set including the first two rows.

head(storm, 2)
##   STATE__          BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE  EVTYPE
## 1       1 4/18/1950 0:00:00     0130       CST     97     MOBILE    AL TORNADO
## 2       1 4/18/1950 0:00:00     0145       CST      3    BALDWIN    AL TORNADO
##   BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## 1         0                                               0         NA
## 2         0                                               0         NA
##   END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES PROPDMG
## 1         0                        14   100 3   0          0       15    25.0
## 2         0                         2   150 2   0          0        0     2.5
##   PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE LONGITUDE
## 1          K       0                                         3040      8812
## 2          K       0                                         3042      8755
##   LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1       3051       8806              1
## 2          0          0              2

As we can see, there are 902297 observations (rows) and 37 variables (columns). 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.

The impact on public health

In this section, we will explore which type of weather events are most harmful with respect to population health across the United States.

Therefore, we need to check the number of INJURIES and FATALITIES that are caused by the severe weather events (EVTYPE). We will take a look at the top 10 most severe type of weather events.

storm.injuries.fatalities <- storm %>% group_by(EVTYPE) %>% summarise(FATALITIES = sum(FATALITIES), INJURIES = sum(INJURIES))
fatalities.ordered <- storm.injuries.fatalities[order(storm.injuries.fatalities$FATALITIES, decreasing = TRUE),]
injuries.ordered <- storm.injuries.fatalities[order(storm.injuries.fatalities$INJURIES, decreasing = TRUE),]
top10fatalities <- fatalities.ordered[1:10, c(1,2)]
top10injuries <- injuries.ordered[1:10, c(1, 3)]

The impact on economy

In this section, we will explore which type of weather events have the greatest economic consequences across the United States.

First, we create a subset of the data set only using the variables we need for our research.

Defining variables that will be used:

  • EVTYPE: Event Type (Tornados, Flood, ….)

  • PROGDMG: Property Damage

  • PROPDMGEXP: Units for Property Damage (magnitudes - K, M, B)

  • CROPDMG: Crop Damage

  • CROPDMGEXP: Units for Crop Damage (magnitudes - K, M, B)

storm.damage <- subset(storm, select = c("EVTYPE", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP"))

Let’s see what the input for the “PROPDMGEXP” and “CROPDMGEXP” is.

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

Now we will refactor these variables so we can estimate the right damage value.

storm$PROPDMGEXP <- mapvalues(storm$PROPDMGEXP, from = c("K", "M","", "B", "m", "+", "0", "5", "6", "?", "4", "2", "3", "h", "7", "H", "-", "1", "8"), to = c(10^3, 10^6, 1, 10^9, 10^6, 0,1,10^5, 10^6, 0, 10^4, 10^2, 10^3, 10^2, 10^7, 10^2, 0, 10, 10^8))
storm$PROPDMGEXP <- as.numeric(as.character(storm$PROPDMGEXP))
storm$PROPDMGTOTAL <- (storm$PROPDMG * storm$PROPDMGEXP)/1000000000

storm$CROPDMGEXP <- mapvalues(storm$CROPDMGEXP, from = c("","M", "K", "m", "B", "?", "0", "k","2"), to = c(1,10^6, 10^3, 10^6, 10^9, 0, 1, 10^3, 10^2))
storm$CROPDMGEXP <- as.numeric(as.character(storm$CROPDMGEXP))
storm$CROPDMGTOTAL <- (storm$CROPDMG * storm$CROPDMGEXP)/1000000000

Now we will calculate the property damage and crop damage for every type of weather event and take a look at the top 10 severe weather events.

propertydamage <- aggregate(PROPDMGTOTAL ~ EVTYPE, data = storm,  FUN="sum")
propertydamage.ordered <- propertydamage[order(propertydamage$PROPDMGTOTAL, decreasing = TRUE),]
top10propertydamage <- propertydamage.ordered[1:10,]
cropdamage <- aggregate(CROPDMGTOTAL ~ EVTYPE, data = storm,  FUN="sum")
cropdamage.ordered <- cropdamage[order(cropdamage$CROPDMGTOTAL, decreasing = TRUE),]
top10cropdamage <- cropdamage.ordered[1:10,]

Results

As for the impact on public health, we have calculated a top 10 for both injuries and fatalities.

top10injuries
## # A tibble: 10 × 2
##    EVTYPE            INJURIES
##    <chr>                <dbl>
##  1 TORNADO              91346
##  2 TSTM WIND             6957
##  3 FLOOD                 6789
##  4 EXCESSIVE HEAT        6525
##  5 LIGHTNING             5230
##  6 HEAT                  2100
##  7 ICE STORM             1975
##  8 FLASH FLOOD           1777
##  9 THUNDERSTORM WIND     1488
## 10 HAIL                  1361
top10fatalities
## # A tibble: 10 × 2
##    EVTYPE         FATALITIES
##    <chr>               <dbl>
##  1 TORNADO              5633
##  2 EXCESSIVE HEAT       1903
##  3 FLASH FLOOD           978
##  4 HEAT                  937
##  5 LIGHTNING             816
##  6 TSTM WIND             504
##  7 FLOOD                 470
##  8 RIP CURRENT           368
##  9 HIGH WIND             248
## 10 AVALANCHE             224

Let’s put the results in a plot for both injuries and fatalities.

ggplot(top10injuries, aes(x = EVTYPE, y = INJURIES)) + geom_bar(stat = "identity", fill = "yellow", col = "black") + xlab("Type of weather event") + ylab("Total number of injuries") + ggtitle("Injuries by Type of weather event") + theme(axis.text.x = element_text(angle = 45, hjust = 1))

ggplot(top10fatalities, aes(x = EVTYPE, y = FATALITIES)) + geom_bar(stat = "identity", fill = "orange", col = "black") + xlab("Type of weather event") + ylab("Total number of fatalities") + ggtitle("Fatalities by Type of weather event") + theme(axis.text.x = element_text(angle = 45, hjust = 1))

Based on the above plots, we can conclude that tornado, thunderstorm wind and flood cause most injuries, and that tornado, excessive heat and flash flood cause most fatalities in the United States from 1995 to 2011.

As for the impact on economy, we have calculated a top 10 for both property damage and crop damage.

top10propertydamage
##                EVTYPE PROPDMGTOTAL
## 170             FLOOD   144.657710
## 411 HURRICANE/TYPHOON    69.305840
## 834           TORNADO    56.947381
## 670       STORM SURGE    43.323536
## 153       FLASH FLOOD    16.822674
## 244              HAIL    15.735268
## 402         HURRICANE    11.868319
## 848    TROPICAL STORM     7.703891
## 972      WINTER STORM     6.688497
## 359         HIGH WIND     5.270046
top10cropdamage
##                EVTYPE CROPDMGTOTAL
## 95            DROUGHT    13.972566
## 170             FLOOD     5.661968
## 590       RIVER FLOOD     5.029459
## 427         ICE STORM     5.022113
## 244              HAIL     3.025954
## 402         HURRICANE     2.741910
## 411 HURRICANE/TYPHOON     2.607873
## 153       FLASH FLOOD     1.421317
## 140      EXTREME COLD     1.292973
## 212      FROST/FREEZE     1.094086

Let’s put the results in one plot.

plot1 <- ggplot(top10propertydamage, aes(x = EVTYPE, y = PROPDMGTOTAL)) + geom_bar(stat = "identity", fill = "pink", col = "black") + xlab("Type of weather event") + ylab("Property Damage in US Dollars") + ggtitle("Total property damage by Type of weather event") + theme(axis.text.x = element_text(angle = 45, hjust = 1))
plot2 <- ggplot(top10cropdamage, aes(x = EVTYPE, y = CROPDMGTOTAL)) + geom_bar(stat = "identity", fill = "purple", col = "black") + xlab("Type of weather event") + ylab("Crop Damage in US Dollars") + ggtitle("Total crop damage by Type of weather event") + theme(axis.text.x = element_text(angle = 45, hjust = 1))
ggarrange(plot1, plot2, nrow = 2, heights = 580, widths = 480)

Based on the above plots, we can conclude that flood and hurricane/typhoon cause most property damage, and that drought and flood cause most fatalities in the United States from 1995 to 2011.