This analysis explores the NOAA Storm Database to determine which types of weather events are most harmful to population health and which have the greatest economic consequences in the United States. The database includes records from 1950 to 2011. We examine fatalities and injuries to assess public health impact and property and crop damage to assess economic impact. Tornadoes are found to cause the most fatalities and injuries, while floods have the highest economic cost. The results aim to inform emergency preparedness and resource allocation.
echo = TRUE
knitr::opts_chunk$set(echo = TRUE)
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
library(ggplot2)
library(scales)
library(gridExtra)
##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
data_file <- "StormData.csv."
if (!file.exists(data_file)) {
stop("Please download the file from the course site and place it in your working directory.")
}
storm_data <- read.csv(data_file)
We’ll focus on these variables: - EVTYPE
: type of event
- FATALITIES
: number of deaths - INJURIES
:
number of injuries - PROPDMG
, PROPDMGEXP
:
property damage - CROPDMG
, CROPDMGEXP
: crop
damage
# Convert damage exponents
exp_to_num <- function(e) {
e <- toupper(as.character(e))
ifelse(e == "K", 1e3,
ifelse(e == "M", 1e6,
ifelse(e == "B", 1e9, 0)))
}
storm_data$PROPDMGEXP <- exp_to_num(storm_data$PROPDMGEXP)
storm_data$CROPDMGEXP <- exp_to_num(storm_data$CROPDMGEXP)
# Compute actual damages
storm_data <- storm_data %>%
mutate(
PROP_DMG_USD = PROPDMG * PROPDMGEXP,
CROP_DMG_USD = CROPDMG * CROPDMGEXP
)
We summarize fatalities and injuries by event type.
health_impact <- storm_data %>%
group_by(EVTYPE) %>%
summarise(Fatalities = sum(FATALITIES, na.rm=TRUE),
Injuries = sum(INJURIES, na.rm=TRUE)) %>%
mutate(Total_Harm = Fatalities + Injuries) %>%
arrange(desc(Total_Harm)) %>%
top_n(10, Total_Harm)
# Plot
p1 <- ggplot(health_impact, aes(x=reorder(EVTYPE, -Total_Harm), y=Fatalities)) +
geom_bar(stat="identity", fill="red") +
labs(title="Top 10 Events by Fatalities", x="Event Type", y="Fatalities") +
theme(axis.text.x = element_text(angle=45, hjust=1))
p2 <- ggplot(health_impact, aes(x=reorder(EVTYPE, -Total_Harm), y=Injuries)) +
geom_bar(stat="identity", fill="orange") +
labs(title="Top 10 Events by Injuries", x="Event Type", y="Injuries") +
theme(axis.text.x = element_text(angle=45, hjust=1))
grid.arrange(p1, p2, nrow=2)
Figure: Tornadoes are the leading cause of both fatalities and injuries.
We summarize property and crop damage by event type.
economic_impact <- storm_data %>%
group_by(EVTYPE) %>%
summarise(Property = sum(PROP_DMG_USD, na.rm=TRUE),
Crop = sum(CROP_DMG_USD, na.rm=TRUE)) %>%
mutate(Total_Damage = Property + Crop) %>%
arrange(desc(Total_Damage)) %>%
top_n(10, Total_Damage)
# Plot
p3 <- ggplot(economic_impact, aes(x=reorder(EVTYPE, -Total_Damage), y=Total_Damage)) +
geom_bar(stat="identity", fill="darkgreen") +
labs(title="Top 10 Events by Economic Damage", x="Event Type", y="Total Damage (USD)") +
scale_y_continuous(labels=dollar) +
theme(axis.text.x = element_text(angle=45, hjust=1))
print(p3)
Figure: Floods cause the most significant economic damage, followed by hurricanes and tornadoes.
The analysis of NOAA storm data shows: - Tornadoes are the most harmful to public health. - Floods cause the greatest economic losses.
Emergency preparedness efforts should prioritize these events to reduce human and financial impact.