Severe weather events can cause public health issues and economic problems for society. This study looks into the type of weather events that result in most causalities (injuries and fatalities) and economic damage (property and crop damage).
Using the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database we answer both questions. Our analysis shows that tornados cause the most causalties (both in injuries and fatalities). Furthermore, floods account for the most economic damage in terms of property and crop damage.
In this section we will consider the question: Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health?
Read the data from the file.
Data <- read.csv('repdata_data_StormData.csv.bz2')
Obtain an overview of the dataset.
str(Data)
## 'data.frame': 902297 obs. of 37 variables:
## $ STATE__ : num 1 1 1 1 1 1 1 1 1 1 ...
## $ BGN_DATE : Factor w/ 16335 levels "1/1/1966 0:00:00",..: 6523 6523 4242 11116 2224 2224 2260 383 3980 3980 ...
## $ BGN_TIME : Factor w/ 3608 levels "00:00:00 AM",..: 272 287 2705 1683 2584 3186 242 1683 3186 3186 ...
## $ TIME_ZONE : Factor w/ 22 levels "ADT","AKS","AST",..: 7 7 7 7 7 7 7 7 7 7 ...
## $ COUNTY : num 97 3 57 89 43 77 9 123 125 57 ...
## $ COUNTYNAME: Factor w/ 29601 levels "","5NM E OF MACKINAC BRIDGE TO PRESQUE ISLE LT MI",..: 13513 1873 4598 10592 4372 10094 1973 23873 24418 4598 ...
## $ STATE : Factor w/ 72 levels "AK","AL","AM",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ EVTYPE : Factor w/ 985 levels " HIGH SURF ADVISORY",..: 834 834 834 834 834 834 834 834 834 834 ...
## $ BGN_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ BGN_AZI : Factor w/ 35 levels ""," N"," NW",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ BGN_LOCATI: Factor w/ 54429 levels "","- 1 N Albion",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ END_DATE : Factor w/ 6663 levels "","1/1/1993 0:00:00",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ END_TIME : Factor w/ 3647 levels ""," 0900CST",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ 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 : Factor w/ 24 levels "","E","ENE","ESE",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ END_LOCATI: Factor w/ 34506 levels "","- .5 NNW",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ 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: Factor w/ 19 levels "","-","?","+",..: 17 17 17 17 17 17 17 17 17 17 ...
## $ CROPDMG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ CROPDMGEXP: Factor w/ 9 levels "","?","0","2",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ WFO : Factor w/ 542 levels ""," CI","$AC",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ STATEOFFIC: Factor w/ 250 levels "","ALABAMA, Central",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ ZONENAMES : Factor w/ 25112 levels ""," "| __truncated__,..: 1 1 1 1 1 1 1 1 1 1 ...
## $ 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 : Factor w/ 436781 levels "","-2 at Deer Park\n",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ REFNUM : num 1 2 3 4 5 6 7 8 9 10 ...
As we are interested in fatalities and injuries due to the event types, we restrict our dataset and calculate the sum of injuries and fatalities of each event type. Next we sort the datasets with decreasing number of injuries and fatalities.
PopulationHarmData <- Data[,c("EVTYPE","FATALITIES","INJURIES")]
injuries <- aggregate(INJURIES~EVTYPE, PopulationHarmData, sum)
injuries <- arrange(injuries, desc(INJURIES))
## Warning: package 'bindrcpp' was built under R version 3.5.1
head(injuries)
## EVTYPE INJURIES
## 1 TORNADO 91346
## 2 TSTM WIND 6957
## 3 FLOOD 6789
## 4 EXCESSIVE HEAT 6525
## 5 LIGHTNING 5230
## 6 HEAT 2100
fatalities <- aggregate(FATALITIES~EVTYPE, PopulationHarmData, sum)
fatalities <- arrange(fatalities, desc(FATALITIES))
head(fatalities)
## EVTYPE FATALITIES
## 1 TORNADO 5633
## 2 EXCESSIVE HEAT 1903
## 3 FLASH FLOOD 978
## 4 HEAT 937
## 5 LIGHTNING 816
## 6 TSTM WIND 504
In order to show the results, we merge the injuries and fatalities datasets and show the corresponding sorted barplot.
total_population_harm <- merge(injuries, fatalities, by.x = "EVTYPE", by.y = "EVTYPE")
total_population_harm <- arrange(total_population_harm, desc(FATALITIES+INJURIES))
EventNames <- total_population_harm$EVTYPE
barplot(t(total_population_harm[,-1]), names.arg = EventNames, xlim=c(0,25), ylim = c(0,95000), col = c("blue", "darkgreen"), beside = T, cex.names = 0.8, las = 2, main="Top disaster events")
legend("topright",c("Fatalities","Injuries"),fill=c("blue", "darkgreen"),bty = "n")
The barplot shows the top 9 weather event types with the highest number of injuries (green) and fatalities (blue).
From the plot above it can be clearly observed that tornado’s create the most harm to the population, both in terms of injuries as well as fatalities.
In this section we will consider the question: Across the United States, which types of events have the greatest economic consequences?
To answer the question we will use a different subset of the data, where we consider the event type, property damage and crop damage.
EconomicData <- Data[,c("EVTYPE", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")]
Next we need to convert the exponents and numbers into an actual number:
EconomicData[,"PROPDAMAGE"] = NA
EconomicData[EconomicData$PROPDMGEXP == "H", "PROPDAMAGE"] = EconomicData[EconomicData$PROPDMGEXP == "H", "PROPDMG"] * 10^2
EconomicData[EconomicData$PROPDMGEXP == "K", "PROPDAMAGE"] = EconomicData[EconomicData$PROPDMGEXP == "K", "PROPDMG"] * 10^3
EconomicData[EconomicData$PROPDMGEXP == "M", "PROPDAMAGE"] = EconomicData[EconomicData$PROPDMGEXP == "M", "PROPDMG"] * 10^6
EconomicData[EconomicData$PROPDMGEXP == "B", "PROPDAMAGE"] = EconomicData[EconomicData$PROPDMGEXP == "B", "PROPDMG"] * 10^9
EconomicData[,"CROPDAMAGE"] = NA
EconomicData[EconomicData$CROPDMGEXP == "H", "CROPDAMAGE"] = EconomicData[EconomicData$CROPDMGEXP == "H", "CROPDMG"] * 10^2
EconomicData[EconomicData$CROPDMGEXP == "K", "CROPDAMAGE"] = EconomicData[EconomicData$CROPDMGEXP == "K", "CROPDMG"] * 10^3
EconomicData[EconomicData$CROPDMGEXP == "M", "CROPDAMAGE"] = EconomicData[EconomicData$CROPDMGEXP == "M", "CROPDMG"] * 10^6
EconomicData[EconomicData$CROPDMGEXP == "B", "CROPDAMAGE"] = EconomicData[EconomicData$CROPDMGEXP == "B", "CROPDMG"] * 10^9
Next we need to aggragate property damage and crop damage into a single feature:
Damage <- aggregate(PROPDAMAGE + CROPDAMAGE ~ EVTYPE, EconomicData, sum)
names(Damage) = c("EventType", "TotalDamage")
Damage <- arrange(Damage, desc(TotalDamage))
# Select top 20
Damage <- Damage[1:20, ]
# Create readable format in Bilions
Damage$TotalDamage <- Damage$TotalDamage/10^9
# Create factors
Damage$EventType <- factor(Damage$EventType, levels = Damage$EventType)
# Show top 5
head(Damage)
## EventType TotalDamage
## 1 FLOOD 138.00744
## 2 HURRICANE/TYPHOON 29.34817
## 3 TORNADO 16.52015
## 4 HURRICANE 12.40527
## 5 RIVER FLOOD 10.10837
## 6 HAIL 10.01998
In the next plot we show the event types with the most economic damage in the US.
with(Damage, barplot(TotalDamage, names.arg = EventType, xlim=c(0,25), col = c("red"), beside = T, cex.names = 0.8, las = 2, main="Top economic damage events", ylab = "Total Damage in USD (bilions)"))
The plot above shows the top 20 of the weather event types with the most economic damage in terms of property and crop damage in bilions.
The results clearly show that floods cause the most economic damage.