Synopsis

This analysis explores the NOAA Storm Database to identify the types of severe weather events that have the greatest impact on public health and the economy across the United States.

The analysis examines fatalities and injuries to assess population health consequences. It also evaluates property and crop damage to measure economic consequences. The results identify the event types associated with the greatest human and economic losses.

Data Processing

Loading the data

The data used in this analysis come from the NOAA Storm Database. The original compressed CSV file was downloaded directly from the course website and loaded into R.

url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"

if (!file.exists("StormData.csv.bz2")) {
  download.file(url, destfile = "StormData.csv.bz2", mode = "wb")
}
storm <- read.csv(
  bzfile("StormData.csv.bz2"),
  stringsAsFactors = FALSE
)

Exploring the data

dim(storm)
## [1] 902297     37
names(storm)
##  [1] "STATE__"    "BGN_DATE"   "BGN_TIME"   "TIME_ZONE"  "COUNTY"    
##  [6] "COUNTYNAME" "STATE"      "EVTYPE"     "BGN_RANGE"  "BGN_AZI"   
## [11] "BGN_LOCATI" "END_DATE"   "END_TIME"   "COUNTY_END" "COUNTYENDN"
## [16] "END_RANGE"  "END_AZI"    "END_LOCATI" "LENGTH"     "WIDTH"     
## [21] "F"          "MAG"        "FATALITIES" "INJURIES"   "PROPDMG"   
## [26] "PROPDMGEXP" "CROPDMG"    "CROPDMGEXP" "WFO"        "STATEOFFIC"
## [31] "ZONENAMES"  "LATITUDE"   "LONGITUDE"  "LATITUDE_E" "LONGITUDE_"
## [36] "REMARKS"    "REFNUM"
str(storm)
## 'data.frame':    902297 obs. of  37 variables:
##  $ STATE__   : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ BGN_DATE  : chr  "4/18/1950 0:00:00" "4/18/1950 0:00:00" "2/20/1951 0:00:00" "6/8/1951 0:00:00" ...
##  $ BGN_TIME  : chr  "0130" "0145" "1600" "0900" ...
##  $ TIME_ZONE : chr  "CST" "CST" "CST" "CST" ...
##  $ COUNTY    : num  97 3 57 89 43 77 9 123 125 57 ...
##  $ COUNTYNAME: chr  "MOBILE" "BALDWIN" "FAYETTE" "MADISON" ...
##  $ STATE     : chr  "AL" "AL" "AL" "AL" ...
##  $ EVTYPE    : chr  "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
##  $ BGN_RANGE : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ BGN_AZI   : chr  "" "" "" "" ...
##  $ BGN_LOCATI: chr  "" "" "" "" ...
##  $ END_DATE  : chr  "" "" "" "" ...
##  $ END_TIME  : chr  "" "" "" "" ...
##  $ 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   : chr  "" "" "" "" ...
##  $ END_LOCATI: chr  "" "" "" "" ...
##  $ 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: chr  "K" "K" "K" "K" ...
##  $ CROPDMG   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ CROPDMGEXP: chr  "" "" "" "" ...
##  $ WFO       : chr  "" "" "" "" ...
##  $ STATEOFFIC: chr  "" "" "" "" ...
##  $ ZONENAMES : chr  "" "" "" "" ...
##  $ 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   : chr  "" "" "" "" ...
##  $ REFNUM    : num  1 2 3 4 5 6 7 8 9 10 ...

Selecting relevant variables

Only the variables needed for the analysis were selected: event type, fatalities, injuries, property damage, crop damage, and their corresponding exponent codes.

storm_data <- storm[, c(
  "EVTYPE",
  "FATALITIES",
  "INJURIES",
  "PROPDMG",
  "PROPDMGEXP",
  "CROPDMG",
  "CROPDMGEXP"
)]

head(storm_data)
##    EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## 1 TORNADO          0       15    25.0          K       0           
## 2 TORNADO          0        0     2.5          K       0           
## 3 TORNADO          0        2    25.0          K       0           
## 4 TORNADO          0        2     2.5          K       0           
## 5 TORNADO          0        2     2.5          K       0           
## 6 TORNADO          0        6     2.5          K       0
dim(storm_data)
## [1] 902297      7

Results

Impact on population health

To evaluate the impact of severe weather events on public health, fatalities and injuries were aggregated by event type.

health_data <- aggregate(
  cbind(FATALITIES, INJURIES) ~ EVTYPE,
  data = storm_data,
  FUN = sum
)

health_data <- health_data[
  order(health_data$FATALITIES, decreasing = TRUE),
]

head(health_data, 10)
##             EVTYPE FATALITIES INJURIES
## 834        TORNADO       5633    91346
## 130 EXCESSIVE HEAT       1903     6525
## 153    FLASH FLOOD        978     1777
## 275           HEAT        937     2100
## 464      LIGHTNING        816     5230
## 856      TSTM WIND        504     6957
## 170          FLOOD        470     6789
## 585    RIP CURRENT        368      232
## 359      HIGH WIND        248     1137
## 19       AVALANCHE        224      170

The following table shows the event types with the highest number of injuries.

injury_data <- health_data[
  order(health_data$INJURIES, decreasing = TRUE),
]

head(injury_data, 10)
##                EVTYPE FATALITIES INJURIES
## 834           TORNADO       5633    91346
## 856         TSTM WIND        504     6957
## 170             FLOOD        470     6789
## 130    EXCESSIVE HEAT       1903     6525
## 464         LIGHTNING        816     5230
## 275              HEAT        937     2100
## 427         ICE STORM         89     1975
## 153       FLASH FLOOD        978     1777
## 760 THUNDERSTORM WIND        133     1488
## 244              HAIL         15     1361

Events with the highest number of fatalities

top_fatalities <- head(health_data, 10)
top_fatalities <- top_fatalities[
  order(top_fatalities$FATALITIES),
]

par(mar = c(5, 10, 4, 2))

barplot(
  top_fatalities$FATALITIES,
  names.arg = top_fatalities$EVTYPE,
  horiz = TRUE,
  las = 1,
  main = "Top 10 Weather Events by Fatalities",
  xlab = "Number of fatalities"
)

Events with the highest number of injuries

top_injuries <- head(
  injury_data[order(injury_data$INJURIES, decreasing = TRUE), ],
  10
)

top_injuries <- top_injuries[
  order(top_injuries$INJURIES),
]

par(mar = c(5, 10, 4, 2))

barplot(
  top_injuries$INJURIES,
  names.arg = top_injuries$EVTYPE,
  horiz = TRUE,
  las = 1,
  main = "Top 10 Weather Events by Injuries",
  xlab = "Number of injuries"
)

Economic consequences

The economic impact was calculated using property and crop damage values. The exponent variables indicate the magnitude of the reported damage.

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

The following function converts the exponent codes into numerical multipliers. The codes H, K, M, and B represent hundreds, thousands, millions, and billions, respectively. Numeric codes are interpreted as powers of ten. Blank codes and the symbols +, -, and ? are treated as unscaled values.

damage_multiplier <- function(x) {
  x <- toupper(trimws(as.character(x)))
  multiplier <- rep(NA_real_, length(x))

  multiplier[x == ""] <- 1
  multiplier[x == "H"] <- 100
  multiplier[x == "K"] <- 1000
  multiplier[x == "M"] <- 1e6
  multiplier[x == "B"] <- 1e9

  numeric_codes <- x %in% as.character(0:9)
  multiplier[numeric_codes] <- 10 ^ as.numeric(x[numeric_codes])

  multiplier[x %in% c("+", "-", "?")] <- 1

  multiplier
}

storm_data$PROP_MULT <- damage_multiplier(storm_data$PROPDMGEXP)
storm_data$CROP_MULT <- damage_multiplier(storm_data$CROPDMGEXP)

storm_data$PROP_DAMAGE <- storm_data$PROPDMG * storm_data$PROP_MULT
storm_data$CROP_DAMAGE <- storm_data$CROPDMG * storm_data$CROP_MULT

We check for missing values after converting the damage exponents.

sum(is.na(storm_data$PROP_MULT))
## [1] 0
sum(is.na(storm_data$CROP_MULT))
## [1] 0
sum(is.na(storm_data$PROP_DAMAGE))
## [1] 0
sum(is.na(storm_data$CROP_DAMAGE))
## [1] 0

Property and crop damage were then aggregated by event type. Total economic damage was calculated by adding property and crop damage.

economic_data <- aggregate(
  cbind(PROP_DAMAGE, CROP_DAMAGE) ~ EVTYPE,
  data = storm_data,
  FUN = sum
)

economic_data$TOTAL_DAMAGE <-
  economic_data$PROP_DAMAGE + economic_data$CROP_DAMAGE

economic_data <- economic_data[
  order(economic_data$TOTAL_DAMAGE, decreasing = TRUE),
]

head(economic_data, 10)
##                EVTYPE  PROP_DAMAGE CROP_DAMAGE TOTAL_DAMAGE
## 170             FLOOD 144657709807  5661968450 150319678257
## 411 HURRICANE/TYPHOON  69305840000  2607872800  71913712800
## 834           TORNADO  56947380677   414953270  57362333947
## 670       STORM SURGE  43323536000        5000  43323541000
## 244              HAIL  15735267513  3025954473  18761221986
## 153       FLASH FLOOD  16822673979  1421317100  18243991079
## 95            DROUGHT   1046106000 13972566000  15018672000
## 402         HURRICANE  11868319010  2741910000  14610229010
## 590       RIVER FLOOD   5118945500  5029459000  10148404500
## 427         ICE STORM   3944927860  5022113500   8967041360

Events with the greatest economic consequences

The following figure shows the ten event types with the highest combined property and crop damage. Values are expressed in billions of US dollars.

top_economic <- head(economic_data, 10)
top_economic <- top_economic[
  order(top_economic$TOTAL_DAMAGE),
]

par(mar = c(5, 10, 4, 2))

barplot(
  top_economic$TOTAL_DAMAGE / 1e9,
  names.arg = top_economic$EVTYPE,
  horiz = TRUE,
  las = 1,
  main = "Top 10 Weather Events by Economic Damage",
  xlab = "Total damage (billions of US dollars)"
)

Overall findings

The results show that tornadoes had the greatest impact on public health, causing the highest number of both fatalities and injuries in the dataset.

Excessive heat was the second leading cause of fatalities, while thunderstorm winds and floods also caused substantial numbers of injuries.

Regarding economic consequences, floods caused the greatest combined property and crop damage, followed by hurricanes and typhoons, and tornadoes.

Overall, the analysis indicates that different types of severe weather events have different consequences. Tornadoes represent the greatest threat to human health, while floods produce the largest economic losses.