Severe weather events can cause public health problems and economic damage, and analyzing the data on the extent of such hazards is key to identify the most dangerous events and to plan their mitigation. In here, I am performing an analysis on the fatality and economic damage of extreme weather events, across the US, from 1950 to 2011, using as a data source the US National Oceanic and Atmospheric Administration (NOAA) storm database. I am specifically looking for the top 10 events in either the most harmful health outcome - fatalities, or in the the highest economic damage, including both property and crop damage. I find that Tornadoes are the most hazardous event for human health, responsible for over 5633 deaths, while floods are the most damaging events economically, with 150319678257 dollars’ worth in material damage, corresponding to 37% and 32% of total reported fatalities and total economic damage, respectively. These results suggest that in the US, federal measures and regulamentation should give priority to the prevention and mitigation of tornado and hurricane damage, since according to the available data, these have been the most hazardous weather events at the country level regarding human death and economic loss.
To perform the analysis, I am downloading the datafile from the corresponding URL and creating a file handle for the file. I use “read.csv()” because it supports reading compressed “csv.bz2” files such as the one holding the data. If reading the file for the first time, take a look a the data using “head()”. It may also be interesting to assess the number of observations with the length function “length()” applied to a data frame column.
download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2","repdata_data_StormData.csv.bz2")
df <- read.csv("repdata_data_StormData.csv.bz2")
head(df)
## 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
## 3 1 2/20/1951 0:00:00 1600 CST 57 FAYETTE AL TORNADO
## 4 1 6/8/1951 0:00:00 0900 CST 89 MADISON AL TORNADO
## 5 1 11/15/1951 0:00:00 1500 CST 43 CULLMAN AL TORNADO
## 6 1 11/15/1951 0:00:00 2000 CST 77 LAUDERDALE AL TORNADO
## BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## 1 0 0 NA
## 2 0 0 NA
## 3 0 0 NA
## 4 0 0 NA
## 5 0 0 NA
## 6 0 0 NA
## END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES PROPDMG
## 1 0 14.0 100 3 0 0 15 25.0
## 2 0 2.0 150 2 0 0 0 2.5
## 3 0 0.1 123 2 0 0 2 25.0
## 4 0 0.0 100 2 0 0 2 2.5
## 5 0 0.0 150 2 0 0 2 2.5
## 6 0 1.5 177 2 0 0 6 2.5
## PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE LONGITUDE
## 1 K 0 3040 8812
## 2 K 0 3042 8755
## 3 K 0 3340 8742
## 4 K 0 3458 8626
## 5 K 0 3412 8642
## 6 K 0 3450 8748
## LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1 3051 8806 1
## 2 0 0 2
## 3 0 0 3
## 4 0 0 4
## 5 0 0 5
## 6 0 0 6
length(df$EVTYPE)
## [1] 902297
This file has a lot of data, including a lot of data we do not need. So I am subsetting the dataset into two datasets, one including relevant information regarding hazards with an effect on health, and one including information regarding hazards with an economic effect. Such objects will be called data_health and data_economy. I will then subset further according to the specific questions that we are being posed.
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
data_health <- df%>% select (STATE__,BGN_DATE,BGN_TIME,STATE,EVTYPE,FATALITIES,INJURIES)
data_economy <- df%>% select (STATE__,BGN_DATE,BGN_TIME,STATE,EVTYPE,PROPDMG,PROPDMGEXP,CROPDMG,CROPDMGEXP)
We were tasked with answering the following questions:
1. Across the United States, which types of events are most harmful with respect to population health?
2. Across the United States, which types of events have the greatest economic consequences?
On the health dataset, we have data on fatalities and on injuries. As it would be difficult to compare the relative effect of death and injury on health, and as we have no information on injury severity, I am using fatalities as the sole factor for this analysis.
On the economy dataset, we have data on property damage and crop damage. As according to the National Weather Service Storm documentation, both are measured in dollars, I am going to sum the values for each event.
Let us proceed with the processing, so we have ready-to-plot data.
Selecting the top 10 weather events in fatalities, ordered by severity:
data_health_st <- data_health %>% group_by(STATE,EVTYPE) %>% summarise(FATALITIES = sum(as.numeric(FATALITIES)),INJURIES = sum(as.numeric(INJURIES)))
## `summarise()` has grouped output by 'STATE'. You can override using the
## `.groups` argument.
data_health_type <- data_health_st %>% group_by(EVTYPE)%>% summarise(FATALITIES = sum(as.numeric(FATALITIES)),INJURIES = sum(as.numeric(INJURIES)))
data_fatality_order <- data_health_type [order(data_health_type$FATALITIES,decreasing = TRUE),]
data_fatality_order_10 <- data_fatality_order[0:10,0:2]
#Locking factor level order in the data, to avoid alphabetical ordering of columns in ggplot:
data_fatality_order_10$EVTYPE <- factor(data_fatality_order_10$EVTYPE, levels = data_fatality_order_10$EVTYPE)
Selecting the top 10 weather events in economic damage, ordered by severity:
#Notice that there is an exponential multiplier on the table, with the letters "K" and "k" meaning thousands, "M" and "m" meaning millions and "B" and "b" meaning billions. To obtain the real ammount in dollars, we have to multiply the damage value by the corresponding multiplier. So my strategy is to set and apply a function turning the letters to the multiplier and doing the operation on crop and property damage, and then proceeding.
exponential_factor <- function(letter) {
case_when(
letter == "K" | letter == "k" ~ 1000,
letter == "M" | letter == "m" ~ 1000000,
letter == "B" | letter == "b" ~ 1000000000,
TRUE ~ 1
)
}
data_economy <- data_economy %>% mutate (PROPDMG_multiplier = exponential_factor(data_economy$PROPDMGEXP))
data_economy <- data_economy %>% mutate (CROPDMG_multiplier = exponential_factor(data_economy$CROPDMGEXP))
data_economy <- data_economy %>% mutate(total_PROPDMG = data_economy$PROPDMG * data_economy$PROPDMG_multiplier)
data_economy <- data_economy %>% mutate(total_CROPDMG = data_economy$CROPDMG * data_economy$CROPDMG_multiplier)
data_economy_st <- data_economy %>% group_by(STATE,EVTYPE) %>% summarise(total_PROPDMG = sum(as.numeric(total_PROPDMG)),total_CROPDMG = sum(as.numeric(total_CROPDMG)))
## `summarise()` has grouped output by 'STATE'. You can override using the
## `.groups` argument.
data_economy_type<- data_economy_st %>% group_by(EVTYPE)%>% summarise(total_PROPDMG = sum(as.numeric(total_PROPDMG)),total_CROPDMG = sum(as.numeric(total_CROPDMG)))
data_economy_type <- data_economy_type %>%
mutate(Total_Damage = total_PROPDMG + total_CROPDMG)
data_property <- data_economy_type [order(data_economy_type$Total_Damage,decreasing = TRUE),]
data_property_10 <- data_property[0:10,0:4]
#Locking factor level order in the data, to avoid alphabetical ordering of columns in ggplot:
data_property_10$EVTYPE <- factor(data_property_10$EVTYPE, levels = data_property_10$EVTYPE)
library (ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
fat10_plot <- ggplot(data_fatality_order_10,aes(x = EVTYPE,y = FATALITIES,fill = EVTYPE))
fat10_plot + geom_bar(stat = "identity") + ggtitle ("Top 10 severe weather events across the United States by fatalities (1950-2011)") +
xlab("Event") + ylab("Fatalities") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, size = 16),
axis.text.y = element_text(size = 16), axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),title = element_text(size = 22))+
scale_y_continuous(breaks=seq(0,6000,1000))+ scale_fill_manual(values = c("red", rep("grey50", nrow(df)-1)))+
guides(fill = "none")
Figure1: Top 10 severe weather events across the United States by associated fatalities between April 1950 and November 2011. The events are ordered by descending order of the number of fatalities. The most harmful event, Tornado, is highlighted in red.
According to our data, the most harmful events in the United States regarding human health are tornadoes. Events associated with heat, floods, wind, thunderstorms and avalanches are also responsible by a high number of deaths.
While it is clear tornadoes have the most impact, how does it weight in the total fatality count? Let us check the fraction of total fatalities derived from tornadoes:
total_fatalities <- sum(data_fatality_order$FATALITIES)
top_fatalities <- data_fatality_order_10$FATALITIES [1]
top_percent_fatalities <- (top_fatalities/total_fatalities*100)
print(paste("Tornados were responsible for", as.character(top_fatalities),
"fatalities within a total number of", as.character(total_fatalities),
"weather event-associated fatalities in the US, during the 1950-2011 interval,",
"corresponding to", as.character(round(top_percent_fatalities,0)), "%", "of such fatalities."))
## [1] "Tornados were responsible for 5633 fatalities within a total number of 15145 weather event-associated fatalities in the US, during the 1950-2011 interval, corresponding to 37 % of such fatalities."
Tornadoes have a major weight in the fatality count, being associated with roughly 37% of registered fatalities.
prop10_plot <- ggplot(data_property_10,aes(x = EVTYPE,y = Total_Damage,fill = EVTYPE))
prop10_plot + geom_bar(stat = "identity") + ggtitle ("Top 10 weather events across the United States by economic damage (1950-2011)") +
xlab("Event") + ylab("Damage (dollars)") + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1, size = 16),
axis.text.y = element_text(size = 16), axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20),title = element_text(size = 22))+
scale_y_continuous(breaks=seq(0,125000000000,25000000000))+ scale_fill_manual(values = c("red", rep("grey50", nrow(df)-1)))+
guides(fill = "none")
Figure2: Top 10 severe weather events across the United States by associated economic damage, in dollars, between April 1950 and November 2011. Economic damage includes both property damage and crop damage. The events are ordered by descending order of damage. The most harmful event, Flood, is highlighted in red.
According to our data, the most harmful events in the United States regarding economic damage are floods. Events associated with hurricanes, tornados, storms, hail and draught are also responsible for a high level of economic damage.
While it is clear floods have the most impact, how does it weight in the total economic damage metric? Let us check the fraction derived from floods:
total_prop_damage <- sum(data_economy$total_PROPDMG)
total_crop_damage <- sum(data_economy$total_CROPDMG)
total_damage_dollars <- total_crop_damage + total_prop_damage
top_damage <- data_property_10$Total_Damage[1]
top_percent_damage <- (top_damage/total_damage_dollars*100)
print(paste("Floods were responsible for", as.character(top_damage),
"dollars in damage within a total number of", as.character(total_damage_dollars), " dollars of weather event-associated economic damage in the US, during the 1950-2011 interval,", "corresponding to", as.character(round(top_percent_damage,0)), "%", "of the total damage value."))
## [1] "Floods were responsible for 150319678257 dollars in damage within a total number of 476422842479.71 dollars of weather event-associated economic damage in the US, during the 1950-2011 interval, corresponding to 32 % of the total damage value."
Floods have a heavy weight in the economic damage derived from weather events, being associated with roughly 32% of registered losses.
According to the NOAA data, in the US, tornadoes have been the most harmful weather event regarding human health, while floods are the ones with the most economic consequences regarding combined property and crop damage, within the 1950 - 2011 period. Resources should therefore be prioritized on the prevention and mitigation of tornados’ and floods’ hazardous effects.