Synopsis

This report analyses the effects of severe weather effects a) in population health and b) economic damage. For the first fatalities and injuries from weather events are taken into account and for the later damages on properties and crops. The data cover a range of 62 years, across USA. The analysis ranks the weather events according their fatalities and injuries. The analysis takes into account both the magnitude of en event (ie. number of deaths) and the probability of that to happen (ie frequency in the 62 year period. The most harmful for population health are tornadoes, thunderstorms, flash floods and then follows floods and hail. In respect of economic damage the most harmful are hail, floods and thunderstorms and then follows tornadoes and flash floods.

Data Processing

The following code reads the data file and keeps only the required variables for the analysis. The required variables are “EVTYPE” which has the event, “FATALITIES” which has the total deaths from the event, “INJURIES” which has the total injuries from the event, “PROPDMG” and PROPDMGEXP which have the value in dollars for the property damages and “CROPDMG” and “CROPDMGEXP” which have the value in dollars of the crop damages.

dt <- read.csv("data/repdata_data_StormData.csv")
dt <- dt[ , c(8,23:28)]

Data Processing of Events

In order to clean up somehow the data file, the leading and trailing spaces in the event type column are removed and all the letters are turned to uppercase.

dt$EVTYPE <- gsub("^\\s+|\\s+$", "", dt$EVTYPE)
dt$EVTYPE = sapply(dt$EVTYPE, toupper)
evtype <- as.data.frame(table(dt$EVTYPE))

The fist thing to mention is that the data file contains 890 events witch are categorized in 890 different event types.

The approach followed was, first, to subset and keep only the data that match exactly with the event types of NOAA directive NWSPD 10-16[1], page 6. So, the data was divided to 2 subsets using an object containing the 48 event types of NOAA: one subset is the one that matches the NOAA event types (dtsub) and the other one with the rest (dtun).

events <- toupper(c("Astronomical Low Tide", "Avalanche", "Blizzard", "Coastal Flood", 
                    "Cold/Wind Chill", "Debris Flow", "Dense Fog", "Dense Smoke", "Drought", 
                    "Dust Devil", "Dust Storm", "Excessive Heat", "Extreme Cold/Wind Chill",
                    "Flash Flood", "Flood", "Frost/Freeze", "Funnel Cloud", "Freezing Fog", 
                    "Hail", "Heat", "Heavy Rain", "Heavy Snow", "High Surf", "High Wind",
                    "Hurricane (Typhoon)", "Ice Storm", "Lake-Effect Snow", "Lakeshore Flood",
                    "Lightning", "Marine Hail M", "Marine High Wind", "Marine Strong Wind", 
                    "Marine Thunderstorm Wind", "Rip Current", "Seiche", "Sleet", 
                    "Storm Surge/Tide", "Strong Wind", "Thunderstorm Wind", "Tornado", 
                    "Tropical Depression", "Tropical Storm", "Tsunami", "Volcanic Ash", 
                    "Waterspout", "Wildfire", "Winter Storm", "Winter Weather"))
selectedRows <- (dt$EVTYPE %in% events)
dtsub <- dt[selectedRows, ] 
dtun <- dt[!selectedRows, ]

The subset witch contains the exactly matched events contains 634913 of the 902297 events, witch is around the 70% of the total events. The rest 30% needs to be transformed in order to match the 48 event types. The way to do this is to replace the event type used in the dtun data frame with the one that is closer to the description, using the agrep function and then re-subset. The events that now match the NOAA event types are transferred to dtsub data frame and deleted from the dtun data frame in order not to be re-processed. The transformations performed are

  • “TSTM” to “THUNDERSTORM”
  • whatever contains “THUNDER” or “MICROBUSRST” or “GUSTN” to “THUNDERSTORM WIND”
  • whatever contains “FLASH” to “FLASH FLOOD”
  • whatever contains “COASTAL FLOOD” to “COASTAL FLOOD”
  • whatever contains “FLOOD” or “FLD” to “FLOOD”
  • whatever contains “HIGH WIND” to “HIGH WIND”
  • whatever contains “STRONG WIND” to “STRONG WIND”
  • whatever contains “HAIL” to “HAIL”
  • whatever contains “TORNADO” to “TORNADO”
  • whatever contains “WATERSP” to “WATERSPOUT”
  • whatever contains “WINTER STORM” to “WINTER STORM”
  • whatever contains “WINT” to “WINTER WEATHER”
  • whatever contains “VOLCANIC” to “VOLCANIC ASH”
  • whatever contains “STORM SURGE” or “TIDE” to “STORM SURGE/TIDE”
  • whatever contains “TROPICAL STORM” to “TROPICAL STORM”
  • whatever contains “SLEET” to “SLEET”
  • whatever contains “RIP CURRENT” to “RIP CURRENT”
  • whatever contains “LIGHTNING” to “LIGHTNING”
  • whatever contains “TROPICAL STORM” to “TROPICAL STORM”
  • whatever contains “LAKE EFFECT” to “LAKE-EFFECT SNOW”
  • whatever contains “ICE STORM” or “ICESTORM” to “ICE STORM”
  • whatever contains “HURRICANE” or “TYPHOON” to “HURRICANE (TYPHOON)”
  • whatever contains “HIGH SURF” to “HIGH SURF”
  • whatever contains “HEAVY SNOW” to “HEAVY SNOW”
  • whatever contains “HEAVY RAIN” or “HEAVY PRECIP” to “HEAVY RAIN”
  • whatever contains “DROUGHT” or “DRY” to “DROUGHT”
  • whatever contains “EXCESSIVE HEAT” to “EXCESSIVE HEAT”
  • whatever contains “HEAT” or “HOT” to “HEAT”
  • whatever contains “FUNNEL” to “FUNNEL CLOUD”
  • whatever contains “FROST” or “FREEZE” to “FROST/FREEZE”
  • whatever contains “FOG” or to “DENSE FOG”
  • whatever contains “SNOW” to “WINTER WEATHER”
dtun$EVTYPE <- gsub("TSTM","THUNDERSTORM", dtun$EVTYPE, ignore.case = TRUE)
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("THUNDER", dtun$EVTYPE, ignore.case = TRUE)] <- "THUNDERSTORM WIND"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("MICROBUSRST", dtun$EVTYPE, ignore.case = TRUE)] <- "THUNDERSTORM WIND"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("GUSTN", dtun$EVTYPE, ignore.case = TRUE)] <- "THUNDERSTORM WIND"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("FLASH", dtun$EVTYPE, ignore.case = TRUE)] <- "FLASH FLOOD"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("COASTAL FLOOD", dtun$EVTYPE, ignore.case = TRUE)] <- "COASTAL FLOOD"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("FLOOD", dtun$EVTYPE, ignore.case = TRUE)] <- "FLOOD"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("FLD", dtun$EVTYPE, ignore.case = TRUE)] <- "FLOOD"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HIGH WIND", dtun$EVTYPE, ignore.case = TRUE)] <- "HIGH WIND"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("STRONG WIND", dtun$EVTYPE, ignore.case = TRUE)] <- "STRONG WIND"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HAIL", dtun$EVTYPE, ignore.case = TRUE)] <- "HAIL"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("TORNADO", dtun$EVTYPE, ignore.case = TRUE)] <- "TORNADO"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("WATERSP", dtun$EVTYPE, ignore.case = TRUE)] <- "WATERSPOUT"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("WINTER STORM", dtun$EVTYPE, ignore.case = TRUE)] <- "WINTER STORM"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("WINT", dtun$EVTYPE, ignore.case = TRUE)] <- "WINTER WEATHER"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("VOLCANIC", dtun$EVTYPE, ignore.case = TRUE)] <- "VOLCANIC ASH"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("STORM SURGE", dtun$EVTYPE, ignore.case = TRUE)] <- "STORM SURGE/TIDE"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("TIDE", dtun$EVTYPE, ignore.case = TRUE)] <- "STORM SURGE/TIDE"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("TROPICAL STORM", dtun$EVTYPE, ignore.case = TRUE)] <- "TROPICAL STORM"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("SLEET", dtun$EVTYPE, ignore.case = TRUE)] <- "SLEET"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("RIP CURRENT", dtun$EVTYPE, ignore.case = TRUE)] <- "RIP CURRENT"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("LIGHTNING", dtun$EVTYPE, ignore.case = TRUE)] <- "LIGHTNING"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("LAKE  EFFECT", dtun$EVTYPE, ignore.case = TRUE)] <- "LAKE-EFFECT SNOW"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("ICE STORM", dtun$EVTYPE, ignore.case = TRUE)] <- "ICE STORM"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("ICESTORM", dtun$EVTYPE, ignore.case = TRUE)] <- "ICE STORM"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HURRICANE", dtun$EVTYPE, ignore.case = TRUE)] <- "HURRICANE (TYPHOON)"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("TYPHOON", dtun$EVTYPE, ignore.case = TRUE)] <- "HURRICANE (TYPHOON)"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HIGH SURF", dtun$EVTYPE, ignore.case = TRUE)] <- "HIGH SURF"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HEAVY SNOW", dtun$EVTYPE, ignore.case = TRUE)] <- "HEAVY SNOW"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HEAVY RAIN", dtun$EVTYPE, ignore.case = TRUE)] <- "HEAVY RAIN"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HEAVY PRECIP", dtun$EVTYPE, ignore.case = TRUE)] <- "HEAVY RAIN"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("DROUGHT", dtun$EVTYPE, ignore.case = TRUE)] <- "DROUGHT"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("DRY", dtun$EVTYPE, ignore.case = TRUE)] <- "DROUGHT"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("EXCESSIVE HEAT", dtun$EVTYPE, ignore.case = TRUE)] <- "EXCESSIVE HEAT"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]
                    
dtun$EVTYPE[agrep("HEAT", dtun$EVTYPE, ignore.case = TRUE)] <- "HEAT"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("HOT", dtun$EVTYPE, ignore.case = TRUE)] <- "HEAT"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("FUNNEL", dtun$EVTYPE, ignore.case = TRUE)] <- "FUNNEL CLOUD"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("FROST", dtun$EVTYPE, ignore.case = TRUE)] <- "FROST/FREEZE"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("FREEZE", dtun$EVTYPE, ignore.case = TRUE)] <- "FROST/FREEZE"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("FOG", dtun$EVTYPE, ignore.case = TRUE)] <- "DENSE FOG"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]

dtun$EVTYPE[agrep("SNOW", dtun$EVTYPE, ignore.case = TRUE)] <- "WINTER WEATHER"
selectedRows <- (dtun$EVTYPE %in% events)
dtsub <- rbind(dtsub, dtun[selectedRows, ])
dtun <- dtun[!selectedRows, ]
evtype <- as.data.frame(table(dtsub$EVTYPE))

The transformation left 892 events witch is the 0.01% of the total events. The categorization of remaining events is a little bit ambiguous. So, they will be left out of the analysis. The events that will be used for the analysis are now categorized to 46 categories.

Data Processing for Health Impacts

The effect of severe weather events to population health is two fold. First, is the fatalities and second the injuries. In order to analyze both and have a common result, the approach of ranking will be used.

The severity of each event is depicted in the total fatalities/injuries were caused by it. But the magnitude is not the only determinant of its damage, because that could be an one time event that caused many deaths/injuries but the probability of happening again are very small. For that reason the frequency of each event is calculated by dividing the total events by the number of years, which is 62 years (2012-1950). The fatality index the is a multiplication of the total fatalities with the frequency.

fatal <- aggregate.data.frame(dtsub$FATALITIES, list(dtsub$EVTYPE), sum)
fatal <- cbind(fatal, evtype$Freq)
colnames(fatal) <- c("event", "total.fatalities", "total.events")
nyears <- 62
fatal$frequency <- fatal$total.events/nyears
fatal$fatality.index <- round(fatal$total.fatalities*fatal$frequency,2)

The same analysis is done for the injuries

injur <- aggregate.data.frame(dtsub$INJURIES, list(dtsub$EVTYPE), sum)
injur <- cbind(injur, evtype$Freq)
colnames(injur) <- c("event", "total.injuries", "total.events" )
injur$frequency <- injur$total.events/nyears
injur$injury.index <- round(injur$total.injuries*injur$frequency,2)

The two list are then ordered by fatality/injury index and a rank is assigned to each event. Then, each list is re-order alphabetically based on the event name and combined into one table. In the final table, the average rank is calculated and the table is ordered by this rank.

fatal <- fatal[order(-fatal$fatality.index), ]
injur <- injur[order(-injur$injury.index), ]
fatal$rank <- seq(1:46)
injur$rank <- seq(1:46)
fatal <- fatal[order(fatal$event), ]
injur <- injur[order(injur$event), ]

ranks <- as.data.frame(cbind(fatal$event, fatal$rank, injur$rank))
colnames(ranks) <- c("Event", "Fatality.Rank", "Injuries.Rank")

ranks$Fatality.Rank <- as.numeric(as.character(ranks$Fatality.Rank))
ranks$Injuries.Rank <- as.numeric(as.character(ranks$Injuries.Rank))
ranks$Average.Rank <- (ranks$Fatality.Rank + ranks$Injuries.Rank)/2
ranks <- ranks[order(ranks$Average.Rank), ]

Data processing for Economic Impacts

The economic impacts are also two fold. One is the property damage and second the damage on crops. There are 2 variables related to property damages and another two for crop damage. According to NOAA directive NWSPD 10-16[1], page 12, the economic estimate of the damage is entered rounded to three significant digits and followed by an alphabetical character signifying the magnitude of the number. Alphabetical characters used to signify magnitude include “K” for thousands, “M” for millions, and “B” for billions. Taking the summary of each variable makes clear that variables PROPDMG and CROPDMG contain the numeric part of the damage. Variables PROPDMGEXP and CROPDMGEXP contain letters, numbers and other signs.

summary(dtsub$PROPDMG) 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    0.00    0.00   12.06    0.50 5000.00
summary(dtsub$CROPDMG) 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   0.000   0.000   1.528   0.000 990.000
as.data.frame(summary(dtsub$PROPDMGEXP)) 
##   summary(dtsub$PROPDMGEXP)
##                      465147
## -                         1
## ?                         8
## +                         5
## 0                       216
## 1                        25
## 2                        13
## 3                         4
## 4                         4
## 5                        28
## 6                         4
## 7                         5
## 8                         1
## B                        40
## h                         1
## H                         6
## K                    424566
## m                         7
## M                     11324
as.data.frame(summary(dtsub$CROPDMGEXP)) 
##   summary(dtsub$CROPDMGEXP)
##                      617534
## ?                         7
## 0                        19
## 2                         1
## B                         9
## k                        21
## K                    281822
## m                         1
## M                      1991

For the purposes of this analysis, for the events that do not have a value in the PROPDMGEXP variable, the value of PROPDMG will be used as is. For those that have an H, K, M or B the value of PROPDMG will be multiplied by 100, 1.000, 1.000.000 and 1.000.000.000 respectively. The rest will be discarded. The following code subsets only the data as describes previously.

dtsubp <- subset(dtsub, PROPDMGEXP == "B")
dtsubp <- rbind(dtsubp, subset(dtsub, PROPDMGEXP == "K"))
dtsubp <- rbind(dtsubp, subset(dtsub, PROPDMGEXP == "m"))
dtsubp <- rbind(dtsubp, subset(dtsub, PROPDMGEXP == "M"))
dtsubp <- rbind(dtsubp, subset(dtsub, PROPDMGEXP == "-"))
dtsubp <- rbind(dtsubp, subset(dtsub, PROPDMGEXP == "h"))
dtsubp <- rbind(dtsubp, subset(dtsub, PROPDMGEXP == "H"))
dtsubp <- rbind(dtsubp, subset(dtsub, PROPDMGEXP == ""))

Next the H, K, M and B indicators are replaced by 100, 1000, 1,000,000, and 1,000,000,000, respectively and the PROPDMGEXP is turned to numeric and multiplied by the PROPDMG variable in order to get the value of the damage.

dtsubp$PROPDMGEXP <- gsub("[Hh]", 100, dtsubp$PROPDMGEXP)
dtsubp$PROPDMGEXP <- gsub("[Kk]", 1000, dtsubp$PROPDMGEXP)
dtsubp$PROPDMGEXP <- gsub("[Mm]", 1000000, dtsubp$PROPDMGEXP)
dtsubp$PROPDMGEXP <- gsub("[Bb]", 1000000000, dtsubp$PROPDMGEXP)

The variable PROPDMGEXP is now turned to numeric and the NA’s introduced are replaced by 1.

dtsubp$PROPDMGEXP <- as.numeric(dtsubp$PROPDMGEXP)
## Warning: NAs introduced by coercion
dtsubp$PROPDMGEXP[is.na(dtsubp$PROPDMGEXP)] <- 1

The total property damage is then calculated by multiplying the PROPDMG with the PROPDMGEXP

dtsubp$PROPDMG <- dtsubp$PROPDMG*dtsubp$PROPDMGEXP

The value of property damage are then summarized to a table by event type

prop.dmg <- aggregate.data.frame(dtsubp$PROPDMG, list(dtsubp$EVTYPE), sum)
colnames(prop.dmg) <- c("event", "property.damage")

Again the total damage is a measure of magnitude. The probability of occurring changes the effects. Because the data used for property damage is a subset of health analysis the frequency has to be recalculated.

evtypd <- as.data.frame(table(dtsubp$EVTYPE))
prop.dmg <- cbind(prop.dmg, evtypd$Freq)
colnames(prop.dmg) <- c("event", "property.damage", "total.events")
prop.dmg$frequency <- prop.dmg$total.events/nyears
prop.dmg$propdmg.index <- prop.dmg$property.damage*prop.dmg$frequency

The same processing is applied to CROPDMGEXP.

dtsubc <- subset(dtsub, CROPDMGEXP == "B")
dtsubc <- rbind(dtsubc, subset(dtsub, CROPDMGEXP == "k"))
dtsubc <- rbind(dtsubc, subset(dtsub, CROPDMGEXP == "K"))
dtsubc <- rbind(dtsubc, subset(dtsub, CROPDMGEXP == "m"))
dtsubc <- rbind(dtsubc, subset(dtsub, CROPDMGEXP == "M"))
dtsubc <- rbind(dtsubc, subset(dtsub, CROPDMGEXP == ""))

dtsubc$CROPDMGEXP <- gsub("[Kk]", 1000, dtsubc$CROPDMGEXP)
dtsubc$CROPDMGEXP <- gsub("[Mm]", 1000000, dtsubc$CROPDMGEXP)
dtsubc$CROPDMGEXP <- gsub("[Bb]", 1000000000, dtsubc$CROPDMGEXP)

dtsubc$CROPDMGEXP <- as.numeric(dtsubc$CROPDMGEXP)
dtsubc$CROPDMGEXP[is.na(dtsubc$CROPDMGEXP)] <- 1

dtsubc$CROPDMG <- dtsubc$CROPDMG*dtsubc$CROPDMGEXP

crop.dmg <- aggregate.data.frame(dtsubc$CROPDMG, list(dtsubc$EVTYPE), sum)
colnames(crop.dmg) <- c("event", "crop.damage")

evtypc <- as.data.frame(table(dtsubc$EVTYPE))
crop.dmg <- cbind(crop.dmg, evtypc$Freq)
colnames(crop.dmg) <- c("event", "crop.damage", "total.events")
crop.dmg$frequency <- crop.dmg$total.events/nyears
crop.dmg$cropdmg.index <- (crop.dmg$crop.damage*crop.dmg$frequency)

The two indexes for property damage and crop damage can be added because the are measured in dollars. The result is giving the event type with the greatest economic damage.

econ.dmg <- cbind(prop.dmg, crop.dmg$cropdmg.index)
econ.dmg <- econ.dmg[ ,c(1,5:6)]
colnames(econ.dmg) <- c("Event", "Property.Damage.Index", "Crop.Damage.Index")
econ.dmg$Total.Damage.Index <- (econ.dmg$Property.Damage.Index + econ.dmg$Crop.Damage.Index)/1000000000
econ.dmg <- econ.dmg[order(-econ.dmg$Total.Damage.Index), ]

Results

the results of the analysis are represented in two sections, first, for the health impacts and second for the economic impacts.

Impacts of Sever Weather Events to Population Health

In the almost 62 years of data collection there have been recorded 902297 events of sever weather, of which the 901405 are valuable for this analysis. In total there have been 1.506810^{4} fatalities and 1.4002610^{5} injuries.

The total fatalities is a meter of magnitude. But the probability of occurrence should also be taken into account. The probability (yearly frequency) is calculated dividing the total events by the number of years. The fatality/injury index is the product of frequency and total fatalities/injuries. Table 1 shows, for each event type, the total occurrences, fatalities injuries and the calculated fatality and injuries indexes.

tbl1 <- cbind(evtype, fatal$total.fatalities, injur$total.injuries, fatal$fatality.index, injur$injury.index)
colnames(tbl1) <- c("Event", "Total Events", "Total Fatalities", "Total Injuries", "Fatalities Index", "Injuries Index")
tbl1
##                       Event Total Events Total Fatalities Total Injuries
## 1     ASTRONOMICAL LOW TIDE          174                0              0
## 2                 AVALANCHE          386              224            170
## 3                  BLIZZARD         2719              101            805
## 4             COASTAL FLOOD          850                6              7
## 5           COLD/WIND CHILL          539               95             12
## 6                 DENSE FOG         1839               80           1078
## 7               DENSE SMOKE           10                0              0
## 8                   DROUGHT         2714               39             34
## 9                DUST DEVIL          149                2             43
## 10               DUST STORM          427               22            440
## 11           EXCESSIVE HEAT         1682             1920           6525
## 12  EXTREME COLD/WIND CHILL         1002              125             24
## 13              FLASH FLOOD        55675             1035           1802
## 14                    FLOOD        31980              758           7853
## 15             FREEZING FOG           46                0              0
## 16             FROST/FREEZE         1787               11             26
## 17             FUNNEL CLOUD         6980                0              3
## 18                     HAIL       289539               32           1376
## 19                     HEAT         1373             1232           2732
## 20               HEAVY RAIN        11781               98            255
## 21               HEAVY SNOW        15785              127           1034
## 22                HIGH SURF          969              146            204
## 23                HIGH WIND        21810              298           1518
## 24      HURRICANE (TYPHOON)          298              133           1333
## 25                ICE STORM         2031               89           1990
## 26         LAKE-EFFECT SNOW          659                0              0
## 27          LAKESHORE FLOOD           23                0              0
## 28                LIGHTNING        15767              817           5231
## 29         MARINE HIGH WIND          135                1              1
## 30       MARINE STRONG WIND           48               14             22
## 31 MARINE THUNDERSTORM WIND        11987               19             34
## 32              RIP CURRENT          777              577            529
## 33                   SEICHE           21                0              0
## 34                    SLEET          122                2              0
## 35         STORM SURGE/TIDE         1164               69            100
## 36              STRONG WIND         3775              111            301
## 37        THUNDERSTORM WIND       325174              745           9551
## 38                  TORNADO        60698             5636          91407
## 39      TROPICAL DEPRESSION           60                0              0
## 40           TROPICAL STORM          697               66            383
## 41                  TSUNAMI           20               33            129
## 42             VOLCANIC ASH           29                0              0
## 43               WATERSPOUT         3849                3             29
## 44                 WILDFIRE         2761               75            911
## 45             WINTER STORM        11438              216           1338
## 46           WINTER WEATHER         9656              111            796
##    Fatalities Index Injuries Index
## 1              0.00           0.00
## 2           1394.58        1058.39
## 3           4429.34       35303.15
## 4             82.26          95.97
## 5            825.89         104.32
## 6           2372.90       31974.87
## 7              0.00           0.00
## 8           1707.19        1488.32
## 9              4.81         103.34
## 10           151.52        3030.32
## 11         52087.74      177016.94
## 12          2020.16         387.87
## 13        929413.31     1618166.94
## 14        390981.29     4050628.06
## 15             0.00           0.00
## 16           317.05         749.39
## 17             0.00         337.74
## 18        149439.48     6425897.81
## 19         27282.84       60500.58
## 20         18621.58       48454.11
## 21         32333.79      263253.06
## 22          2281.84        3188.32
## 23        104828.71      533993.23
## 24           639.26        6407.00
## 25          2915.47       65188.55
## 26             0.00           0.00
## 27             0.00           0.00
## 28        207768.37     1330277.05
## 29             2.18           2.18
## 30            10.84          17.03
## 31          3673.44        6573.52
## 32          7231.11        6629.56
## 33             0.00           0.00
## 34             3.94           0.00
## 35          1295.42        1877.42
## 36          6758.47       18327.02
## 37       3907332.74    50092530.23
## 38       5517644.00    89487453.00
## 39             0.00           0.00
## 40           741.97        4305.66
## 41            10.65          41.61
## 42             0.00           0.00
## 43           186.24        1800.34
## 44          3339.92       40568.89
## 45         39848.52      246839.42
## 46         17287.35      123970.58

The following pie charts show the top 5 events with greater fatalities and injuries respectively

fatal <- fatal[order(-fatal$total.fatalities), ]
injur <- injur[order(-injur$total.injuries), ]
par(mfrow = c(1, 2))
pie(fatal$total.fatalities[1:5], labels = fatal$event[1:5], radius = 0.7, cex= 0.6, main = "Top 5 Events with Greater Fatalities", cex.main = 0.8)
pie(injur$total.injuries[1:5], labels = injur$event[1:5], clockwise = TRUE, radius = 0.7, cex = 0.5, main = "Top 5 events with Greater Injuries", cex.main = 0.8)

Because it is not right to add fatalities with injuries, the following table shows the rank of the events for fatalities and injuries and the average rank. The events are ordered from the most to the least harmful with respect to population health. Indisputably, The tornadoes are the events that are the most harmful and thunderstorm wind and flash floods are following.

ranks
##                       Event Fatality.Rank Injuries.Rank Average.Rank
## 38                  TORNADO             1             1          1.0
## 37        THUNDERSTORM WIND             2             2          2.0
## 13              FLASH FLOOD             3             5          4.0
## 14                    FLOOD             4             4          4.0
## 18                     HAIL             6             3          4.5
## 28                LIGHTNING             5             6          5.5
## 23                HIGH WIND             7             7          7.0
## 11           EXCESSIVE HEAT             8            10          9.0
## 21               HEAVY SNOW            10             8          9.0
## 45             WINTER STORM             9             9          9.0
## 19                     HEAT            11            13         12.0
## 46           WINTER WEATHER            13            11         12.0
## 20               HEAVY RAIN            12            14         13.0
## 25                ICE STORM            19            12         15.5
## 3                  BLIZZARD            16            16         16.0
## 32              RIP CURRENT            14            19         16.5
## 36              STRONG WIND            15            18         16.5
## 44                 WILDFIRE            18            15         16.5
## 6                 DENSE FOG            20            17         18.5
## 31 MARINE THUNDERSTORM WIND            17            20         18.5
## 22                HIGH SURF            21            23         22.0
## 24      HURRICANE (TYPHOON)            28            21         24.5
## 40           TROPICAL STORM            27            22         24.5
## 8                   DROUGHT            23            27         25.0
## 35         STORM SURGE/TIDE            25            25         25.0
## 2                 AVALANCHE            24            28         26.0
## 12  EXTREME COLD/WIND CHILL            22            30         26.0
## 10               DUST STORM            31            24         27.5
## 43               WATERSPOUT            30            26         28.0
## 5           COLD/WIND CHILL            26            32         29.0
## 16             FROST/FREEZE            29            29         29.0
## 4             COASTAL FLOOD            32            34         33.0
## 9                DUST DEVIL            35            33         34.0
## 30       MARINE STRONG WIND            33            36         34.5
## 41                  TSUNAMI            34            35         34.5
## 17             FUNNEL CLOUD            41            31         36.0
## 29         MARINE HIGH WIND            37            37         37.0
## 1     ASTRONOMICAL LOW TIDE            38            38         38.0
## 7               DENSE SMOKE            39            39         39.0
## 15             FREEZING FOG            40            40         40.0
## 34                    SLEET            36            44         40.0
## 26         LAKE-EFFECT SNOW            42            41         41.5
## 27          LAKESHORE FLOOD            43            42         42.5
## 33                   SEICHE            44            43         43.5
## 39      TROPICAL DEPRESSION            45            45         45.0
## 42             VOLCANIC ASH            46            46         46.0

Economic Impacts of Sever Weather Events

Of the 902297 events of sever weather, the 901092 are valuable for economic analysis of damages done in properties and 901378 for crop damages. The total amount of damages done is 3.278302510^{-4} bil. dollars, of with the 2.97313910^{5} bil. dollars is damages on properties and the 3.051635410^{4} bil. dollars on crops. The following table shows the damages of each event on damages, crops and total.

tbl2 <- cbind(prop.dmg,crop.dmg$crop.damage)
tbl2 <- tbl2[ , c(1:2, 6) ]
tbl2$Total <- tbl2[ ,2] + tbl2[ ,3]
colnames(tbl2) <- c("Event", "Property Damages", "Crop Damages", "Total Damages")
colnames(tbl2) <- c("Event", "Property Damages", "Crop Damages", "Total Damages")
tbl2
##                       Event Property Damages Crop Damages Total Damages
## 1     ASTRONOMICAL LOW TIDE           320000            0        320000
## 2                 AVALANCHE          3721800            0       3721800
## 3                  BLIZZARD        659213950    112060000     771273950
## 4             COASTAL FLOOD        432616060        56000     432672060
## 5           COLD/WIND CHILL          1990000       600000       2590000
## 6                 DENSE FOG         27829500       500000      28329500
## 7               DENSE SMOKE           100000            0        100000
## 8                   DROUGHT       1046451000  13972621780   15019072780
## 9                DUST DEVIL           718630            0        718630
## 10               DUST STORM          5549000      3100000       8649000
## 11           EXCESSIVE HEAT          7753700    634402000     642155700
## 12  EXTREME COLD/WIND CHILL          8648000        50000       8698000
## 13              FLASH FLOOD      16907427827   1532197150   18439624977
## 14                    FLOOD     154202432257  12379738430  166582170687
## 15             FREEZING FOG          2182000            0       2182000
## 16             FROST/FREEZE         29926500   1997061000    2026987500
## 17             FUNNEL CLOUD           194600            0        194600
## 18                     HAIL      15975349277   3063887603   19039236880
## 19                     HEAT         18736550    413045900     431782450
## 20               HEAVY RAIN       3207538140    793899800    4001437940
## 21               HEAVY SNOW        949777650    134653100    1084430750
## 22                HIGH SURF        113525000      1500000     115025000
## 23                HIGH WIND       6048005928    694801900    6742807828
## 24      HURRICANE (TYPHOON)      85256410010   5506117800   90762527810
## 25                ICE STORM       3945527810   5022113500    8967641310
## 26         LAKE-EFFECT SNOW         40182000            0      40182000
## 27          LAKESHORE FLOOD          7540000            0       7540000
## 28                LIGHTNING        938732283     12092090     950824373
## 29         MARINE HIGH WIND          1297010            0       1297010
## 30       MARINE STRONG WIND           418330            0        418330
## 31 MARINE THUNDERSTORM WIND          5857400        50000       5907400
## 32              RIP CURRENT           163000            0        163000
## 33                   SEICHE           980000            0        980000
## 34                    SLEET          2000000            0       2000000
## 35         STORM SURGE/TIDE      48301025100     20872000   48321897100
## 36              STRONG WIND        182874240     69953500     252827740
## 37        THUNDERSTORM WIND      12580116707   1274390458   13854507165
## 38                  TORNADO      56993097683    414961310   57408058993
## 39      TROPICAL DEPRESSION          1737000            0       1737000
## 40           TROPICAL STORM       7714390550    694896000    8409286550
## 41                  TSUNAMI        144062000        20000     144082000
## 42             VOLCANIC ASH           500000            0        500000
## 43               WATERSPOUT          9564700            0       9564700
## 44                 WILDFIRE       4765114000    295472800    5060586800
## 45             WINTER STORM       6689997250     27444000    6717441250
## 46           WINTER WEATHER         62824600     15870000      78694600

Again the total damages are a measure of magnitude. The probability of happening needs to be taken into account. the process is the same as in health analysis. The next table summarizes the results.

tbl3 <- econ.dmg
tbl3 <- tbl3[order(-tbl3$Total.Damage.Index), ]
colnames(tbl3) <- c("Event", "Property Damage Index", "Crop Damage Index", "Total Damage Index")
tbl3
##                       Event Property Damage Index Crop Damage Index
## 18                     HAIL          7.459638e+13      1.430816e+13
## 14                    FLOOD          7.952120e+13      6.385549e+12
## 37        THUNDERSTORM WIND          6.593868e+13      6.683541e+12
## 38                  TORNADO          5.577786e+13      4.062204e+11
## 13              FLASH FLOOD          1.517687e+13      1.375814e+12
## 23                HIGH WIND          2.127142e+12      2.444022e+11
## 45             WINTER STORM          1.234089e+12      5.062975e+09
## 35         STORM SURGE/TIDE          9.060337e+11      3.918550e+08
## 20               HEAVY RAIN          6.094840e+11      1.508538e+11
## 8                   DROUGHT          4.580755e+10      6.114149e+11
## 24      HURRICANE (TYPHOON)          4.097808e+11      2.646489e+10
## 25                ICE STORM          1.291842e+11      1.645147e+11
## 21               HEAVY SNOW          2.417644e+11      3.428224e+10
## 28                LIGHTNING          2.383926e+11      3.075097e+09
## 44                 WILDFIRE          2.122013e+11      1.315807e+10
## 40           TROPICAL STORM          8.672468e+10      7.811976e+09
## 16             FROST/FREEZE          8.625590e+08      5.756045e+10
## 3                  BLIZZARD          2.890972e+10      4.914373e+09
## 11           EXCESSIVE HEAT          2.103504e+08      1.721071e+10
## 36              STRONG WIND          1.113468e+10      4.259266e+09
## 46           WINTER WEATHER          9.784425e+09      2.471625e+09
## 19                     HEAT          4.149239e+08      9.146968e+09
## 4             COASTAL FLOOD          5.931027e+09      7.677419e+05
## 22                HIGH SURF          1.774286e+09      2.344355e+07
## 31 MARINE THUNDERSTORM WIND          1.132462e+09      9.666935e+06
## 6                 DENSE FOG          8.254589e+08      1.483065e+07
## 43               WATERSPOUT          5.937827e+08      0.000000e+00
## 26         LAKE-EFFECT SNOW          4.270958e+08      0.000000e+00
## 12  EXTREME COLD/WIND CHILL          1.397628e+08      8.080645e+05
## 10               DUST STORM          3.821650e+07      2.135000e+07
## 41                  TSUNAMI          4.647161e+07      6.451613e+03
## 2                 AVALANCHE          2.317121e+07      0.000000e+00
## 5           COLD/WIND CHILL          1.730016e+07      5.216129e+06
## 17             FUNNEL CLOUD          2.190819e+07      0.000000e+00
## 34                    SLEET          3.935484e+06      0.000000e+00
## 29         MARINE HIGH WIND          2.824135e+06      0.000000e+00
## 27          LAKESHORE FLOOD          2.797097e+06      0.000000e+00
## 32              RIP CURRENT          2.042758e+06      0.000000e+00
## 9                DUST DEVIL          1.727030e+06      0.000000e+00
## 39      TROPICAL DEPRESSION          1.680968e+06      0.000000e+00
## 15             FREEZING FOG          1.618903e+06      0.000000e+00
## 1     ASTRONOMICAL LOW TIDE          8.980645e+05      0.000000e+00
## 33                   SEICHE          3.319355e+05      0.000000e+00
## 30       MARINE STRONG WIND          3.238684e+05      0.000000e+00
## 42             VOLCANIC ASH          2.338710e+05      0.000000e+00
## 7               DENSE SMOKE          1.612903e+04      0.000000e+00
##    Total Damage Index
## 18       8.890454e+04
## 14       8.590675e+04
## 37       7.262222e+04
## 38       5.618408e+04
## 13       1.655268e+04
## 23       2.371544e+03
## 45       1.239152e+03
## 35       9.064256e+02
## 20       7.603377e+02
## 8        6.572224e+02
## 24       4.362457e+02
## 25       2.936989e+02
## 21       2.760466e+02
## 28       2.414677e+02
## 44       2.253594e+02
## 40       9.453666e+01
## 16       5.842301e+01
## 3        3.382409e+01
## 11       1.742106e+01
## 36       1.539395e+01
## 46       1.225605e+01
## 19       9.561892e+00
## 4        5.931794e+00
## 22       1.797729e+00
## 31       1.142129e+00
## 6        8.402895e-01
## 43       5.937827e-01
## 26       4.270958e-01
## 12       1.405709e-01
## 10       5.956650e-02
## 41       4.647806e-02
## 2        2.317121e-02
## 5        2.251629e-02
## 17       2.190819e-02
## 34       3.935484e-03
## 29       2.824135e-03
## 27       2.797097e-03
## 32       2.042758e-03
## 9        1.727030e-03
## 39       1.680968e-03
## 15       1.618903e-03
## 1        8.980645e-04
## 33       3.319355e-04
## 30       3.238684e-04
## 42       2.338710e-04
## 7        1.612903e-05

The bar chart below shoes the Top 5 weather events with the greater economic damage

height <- tbl3[1:5, 4]
barplot(height, names.arg = tbl3[1:5, 1], main = "Top 5 in Economic Damage", xlab = "Event", ylab = "Economic Damage Index", cex.names = 0.5 )