This report analyzes the impact of severe weather events on public health and the economy in the United States using the NOAA Storm Database. The database covers events from 1950 to 2011. We focus on two main questions: which events are most harmful to population health (fatalities and injuries) and which have the greatest economic consequences (property and crop damage). Our analysis reveals that Tornadoes are the most significant threat to population health, while Floods cause the most substantial economic damage. We processed the raw data to standardize economic damage values and aggregated the results by event type. The top 10 most impactful event types for both health and economy are presented in the Results section.
The data is loaded directly from the compressed CSV file.
# Download the data if it doesn't exist
if (!file.exists("StormData.csv.bz2")) {
download.url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(download.url, destfile = "StormData.csv.bz2")
}
# Read the data
storm_data <- read.csv("StormData.csv.bz2")
We define health impact as the sum of fatalities and injuries.
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)
health_impact <- storm_data %>%
group_by(EVTYPE) %>%
summarize(Total_Fatalities = sum(FATALITIES),
Total_Injuries = sum(INJURIES),
Total_Health_Impact = sum(FATALITIES + INJURIES)) %>%
arrange(desc(Total_Health_Impact))
# Top 10 events for health impact
top_health_events <- head(health_impact, 10)
Economic impact is the sum of property damage and crop damage. The
damage values are stored in two parts: a base value
(PROPDMG and CROPDMG) and an exponent
(PROPDMGEXP and CROPDMGEXP). We need to
convert these into actual dollar amounts.
The exponents are: - K: 1,000 (thousands) - M: 1,000,000 (millions) - B: 1,000,000,000 (billions) - Other characters: assumed as 1
# Function to convert exponents to multiplier
get_multiplier <- function(exp) {
if (is.null(exp) || is.na(exp)) return(1)
exp <- toupper(trimws(as.character(exp)))
if (exp == "") return(1)
if (exp == "K") return(1000)
if (exp == "M") return(1000000)
if (exp == "B") return(1000000000)
if (exp %in% c("0", "1", "2", "3", "4", "5", "6", "7", "8")) return(10)
if (exp == "H") return(100)
return(1)
}
# Vectorize the multiplier function
v_get_multiplier <- Vectorize(get_multiplier)
# Calculate total damage
economic_impact <- storm_data %>%
mutate(Prop_Multiplier = v_get_multiplier(PROPDMGEXP),
Crop_Multiplier = v_get_multiplier(CROPDMGEXP),
Total_Prop_Damage = PROPDMG * Prop_Multiplier,
Total_Crop_Damage = CROPDMG * Crop_Multiplier,
Total_Economic_Damage = Total_Prop_Damage + Total_Crop_Damage) %>%
group_by(EVTYPE) %>%
summarize(Total_Prop_Damage = sum(Total_Prop_Damage),
Total_Crop_Damage = sum(Total_Crop_Damage),
Total_Economic_Damage = sum(Total_Economic_Damage)) %>%
arrange(desc(Total_Economic_Damage))
# Top 10 events for economic impact
top_economic_events <- head(economic_impact, 10)
The following plot shows the top 10 event types that are most harmful to population health in terms of total fatalities and injuries.
ggplot(top_health_events, aes(x = reorder(EVTYPE, -Total_Health_Impact), y = Total_Health_Impact)) +
geom_bar(stat = "identity", fill = "salmon") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Top 10 Severe Weather Events by Population Health Impact",
x = "Event Type",
y = "Total Fatalities and Injuries",
caption = "Figure 1: Tornadoes are the leading cause of fatalities and injuries across the US.")
The following plot shows the top 10 event types that have the greatest economic consequences in terms of property and crop damage.
ggplot(top_economic_events, aes(x = reorder(EVTYPE, -Total_Economic_Damage), y = Total_Economic_Damage / 1e9)) +
geom_bar(stat = "identity", fill = "steelblue") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Top 10 Severe Weather Events by Economic Impact",
x = "Event Type",
y = "Total Damage (Billions of USD)",
caption = "Figure 2: Floods cause the highest total economic damage, primarily due to property loss.")