Human and Economic Costs Associated with Severe Weather Events in the US

SYNOPSIS

This analysis downloads data from the US National Oceanic and Atmospheric Administration's (NOAA) storm database to determine which severe whether events have the biggest human and economic effects in the US.

Results demonstrate that

DATA PROCESSING

The data for this assignment was downloaded directly from the NOAA website.

setwd("C:/Users/Owner/Documents/DataScienceCertification/RepoResearch/peer2")
myURL<-"http://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(myURL,"StormData.csv.bz2")
df1<-read.csv(bzfile("StormData.csv.bz2"), stringsAsFactors=FALSE)

Next, a subset of the data frame relevant for the analysis is taken. The subset includes
1. Only the columns required for the analysis, and
2. Only rows for which there is non-zero human and/or economic impact

# Select Only Relevant Columns for Analysis
df2<-df1[,c("EVTYPE","FATALITIES","INJURIES","PROPDMG","PROPDMGEXP","CROPDMG","CROPDMGEXP")]
# Select Only Rows with Non Zero Human or Economic Costs
df3<-df2[rowSums(df2[,c("FATALITIES","INJURIES","PROPDMG","CROPDMG")])>0,]

Some of the events listed in the database are coded with various lowercase and uppercase formats, but represent the same weather events. Therefore, event type was converted to all uppercase to consolidate these cases.

# Format All Event Types in Uppercase
df3$EVTYPE.Upper<-toupper(df3$EVTYPE)

In order to estimate economic damage, it is necessary to transform the economic measures. For both property damage and crop damage, there is a column of numeric values and a column of multipliers. The column of multipliers indicates the magnitude of the numeric values (H=Hundreds, K=Thousands, M=Millions, and B=Billions). As with event type, it is necessary to convert the multipliers to consistent values (i.e. all uppercase). Then a function is applied to transform the combination of the numerical column and the column of multipliers into the actual economic costs associated with property damage and crop damage.

# Format All DMGEXP in Uppercase
df3$PROPDMGEXP<-toupper(df3$PROPDMGEXP)
df3$CROPDMGEXP<-toupper(df3$CROPDMGEXP)

# Transormation Function
convertMe<-function(x){if(x=="H"){
            100
          } else if(x=="K"){
            1000
          } else if(x=="M"){
            1000000
          } else if(x=="B"){
            1000000000
          } else {
            1
          }
}
df3$P.DMG<-df3$PROPDMG*sapply(df3$PROPDMGEXP,convertMe)
df3$C.DMG<-df3$CROPDMG*sapply(df3$CROPDMGEXP,convertMe)

Once the economic variables have been transformed, the data is once again subset to obtain only the data required for the analysis.

df4<-df3[,c("EVTYPE.Upper","FATALITIES","INJURIES","P.DMG","C.DMG")]

Now the data is summarized in two distinct data tables.

The first sums the number of fatalities and injuries associated with each type of severe weather event. Note that since we are interested in studying the most severe events, those event types with less than or equal to 10 total fatalities plus injuries are excluded.

Similarly, a table summing the economic impact on property and crops is calculated such that the total value is greater than $1,000,000.

library(reshape2)
## Warning: package 'reshape2' was built under R version 3.0.3
# Summarize Fatalities and Injuries by EVTYPE
dfFatalities<-dcast(data=df4, EVTYPE.Upper~ ., value.var="FATALITIES", sum)
names(dfFatalities)<-c("Event.Type","Fatalities")
dfInjuries<-dcast(data=df4, EVTYPE.Upper~ ., value.var="INJURIES", sum)
names(dfInjuries)<-c("Event.Type","Injuries")
dfHuman<-merge(dfFatalities,dfInjuries)
# Select Only Big Events Affecting Human Well Being
dfHuman<- dfHuman[dfHuman$Fatalities + dfHuman$Injuries > 10,]
dfHuman<- dfHuman[order(dfHuman$Fatalities,decreasing=TRUE),]

# Summarize Economic Impact by EVTYPE
dfProp<-dcast(data=df4, EVTYPE.Upper~ ., value.var="P.DMG", sum)
names(dfProp)<-c("Event.Type","Property.Damage")
dfCrop<-dcast(data=df4, EVTYPE.Upper~ ., value.var="C.DMG", sum)
names(dfCrop)<-c("Event.Type","Crop.Damage")
dfEcon<-merge(dfProp,dfCrop)
# Select Only Big Events Affecting Economic Well Being
dfEcon<- dfEcon[dfEcon$Property.Damage + dfEcon$Crop.Damage > 1000000,]
dfEcon<- dfEcon[order(dfEcon$Property.Damage,decreasing=TRUE),]

Finally, process the data to generate plots that will be included in the results section. Note: only the top 20 severe weather events are included in the plots.

# Graph Human Impact
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.0.3
library(reshape2)
dfHumanLong<-melt(dfHuman[1:20,],id.var=c("Event.Type"))
pHuman<- ggplot(data=dfHumanLong,aes(x=Event.Type,y=value))
pHuman<- pHuman + geom_bar(stat="identity") 
pHuman<- pHuman + facet_wrap(~variable, scales="free")
pHuman<- pHuman + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))
pHuman<- pHuman + ylab("Number of People") + ggtitle("Human Impact From Severe Weather Events in the US")

# Graph Economic Impact
library(ggplot2)
library(reshape2)
dfEconLong<-melt(dfEcon[1:20,],id.var=c("Event.Type"))
pEcon<- ggplot(data=dfEconLong,aes(x=Event.Type,y=value))
pEcon<- pEcon + geom_bar(stat="identity") 
pEcon<- pEcon + facet_wrap(~variable, scales="free")
pEcon<- pEcon + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))
pEcon<- pEcon + ylab("US Dollars ($)") +  ggtitle("Economic Impact From Severe Weather Events in the US")

RESULTS

Human Impact

The table and plot (below) summarize the total number of fatalities and injuries associated with each severe weather event. While some of the severe weather events could certainly be consolidated, it is clear that far more deaths and injuries occur with tornadoes than any other weather event.

dfHuman
##                     Event.Type Fatalities Injuries
## 371                    TORNADO       5633    91346
## 54              EXCESSIVE HEAT       1903     6525
## 65                 FLASH FLOOD        978     1777
## 133                       HEAT        937     2100
## 233                  LIGHTNING        816     5230
## 386                  TSTM WIND        504     6957
## 78                       FLOOD        470     6789
## 276                RIP CURRENT        368      232
## 179                  HIGH WIND        248     1137
## 11                   AVALANCHE        224      170
## 441               WINTER STORM        206     1321
## 277               RIP CURRENTS        204      297
## 134                  HEAT WAVE        172      379
## 59                EXTREME COLD        162      231
## 329          THUNDERSTORM WIND        133     1488
## 151                 HEAVY SNOW        127     1021
## 60     EXTREME COLD/WIND CHILL        125       24
## 174                  HIGH SURF        104      156
## 319                STRONG WIND        103      280
## 14                    BLIZZARD        101      805
## 140                 HEAVY RAIN         98      251
## 61                EXTREME HEAT         96      155
## 35             COLD/WIND CHILL         95       12
## 216                  ICE STORM         89     1975
## 433                   WILDFIRE         75      911
## 203          HURRICANE/TYPHOON         64     1275
## 346         THUNDERSTORM WINDS         64      908
## 90                         FOG         62      734
## 194                  HURRICANE         61       46
## 381             TROPICAL STORM         58      340
## 169       HEAVY SURF/HIGH SURF         42       48
## 28                        COLD         38       48
## 224                  LANDSLIDE         38       52
## 187                 HIGH WINDS         35      302
## 403                    TSUNAMI         33      129
## 444             WINTER WEATHER         33      398
## 409  UNSEASONABLY WARM AND DRY         29        0
## 419       URBAN/SML STREAM FLD         28       79
## 446         WINTER WEATHER/MIX         28       72
## 377 TORNADOES, TSTM WIND, HAIL         25        0
## 435                       WIND         23       86
## 50                  DUST STORM         22      440
## 74              FLASH FLOODING         19        8
## 40                   DENSE FOG         18      342
## 63           EXTREME WINDCHILL         17        5
## 82           FLOOD/FLASH FLOOD         17       15
## 275      RECORD/EXCESSIVE HEAT         17        0
## 116                       HAIL         15     1361
## 30               COLD AND SNOW         14        0
## 72           FLASH FLOOD/FLOOD         14        0
## 249         MARINE STRONG WIND         14       22
## 317                STORM SURGE         13       38
## 431           WILD/FOREST FIRE         12      545
## 318           STORM SURGE/TIDE         11        5
## 408          UNSEASONABLY WARM         11       17
## 250   MARINE THUNDERSTORM WIND         10       26
## 443              WINTER STORMS         10       17
## 251           MARINE TSTM WIND          9        8
## 166                 HEAVY SURF          8       40
## 284                 ROUGH SEAS          8        5
## 320               STRONG WINDS          8       21
## 384      TROPICAL STORM GORDON          8       43
## 96               FREEZING RAIN          7       23
## 104                      GLAZE          7      216
## 248              MARINE MISHAP          7        5
## 208                        ICE          6      137
## 173                  HIGH SEAS          5        8
## 219                  ICY ROADS          5       31
## 296                       SNOW          5       31
## 400             TSTM WIND/HAIL          5       95
## 115                GUSTY WINDS          4       11
## 135          HEAT WAVE DROUGHT          4       15
## 46              DRY MICROBURST          3       28
## 182         HIGH WIND AND SEAS          3       20
## 422                 WATERSPOUT          3       29
## 427         WATERSPOUT/TORNADO          3       42
## 430                 WILD FIRES          3      150
## 17                BLOWING SNOW          2       14
## 48                  DUST DEVIL          2       43
## 55          EXCESSIVE RAINFALL          2       21
## 94            FREEZING DRIZZLE          2       15
## 255               MIXED PRECIP          2       26
## 272                RECORD HEAT          2       50
## 302                SNOW SQUALL          2       35
## 13                   BLACK ICE          1       24
## 325               THUNDERSTORM          1       12
## 442    WINTER STORM HIGH WINDS          1       15
## 447                 WINTRY MIX          1       77
## 106            GLAZE/ICE STORM          0       15
## 310            SNOW/HIGH WINDS          0       36
## 365              THUNDERSTORMW          0       27
## 374                 TORNADO F2          0       16
## 445         WINTER WEATHER MIX          0       68
pHuman

plot of chunk humanSummary

Economic Impact

The table and plot (below) summarize the total cost of property damage and crop damage associated with each severe weather event. While some of the severe weather events could certainly be consolidated, it is clear that flooding and events that lead to flooding have the largest economic impact in the US, especially for property damage. However, note that ice storms and hail also have a large impact on crop damage.

dfEcon
##                        Event.Type Property.Damage Crop.Damage
## 78                          FLOOD       1.447e+11   5.662e+09
## 203             HURRICANE/TYPHOON       6.931e+10   2.608e+09
## 371                       TORNADO       5.694e+10   4.150e+08
## 317                   STORM SURGE       4.332e+10   5.000e+03
## 65                    FLASH FLOOD       1.614e+10   1.421e+09
## 116                          HAIL       1.573e+10   3.026e+09
## 194                     HURRICANE       1.187e+10   2.742e+09
## 381                TROPICAL STORM       7.704e+09   6.783e+08
## 441                  WINTER STORM       6.688e+09   2.694e+07
## 179                     HIGH WIND       5.270e+09   6.386e+08
## 280                   RIVER FLOOD       5.119e+09   5.029e+09
## 433                      WILDFIRE       4.765e+09   2.955e+08
## 318              STORM SURGE/TIDE       4.641e+09   8.500e+05
## 386                     TSTM WIND       4.485e+09   5.540e+08
## 216                     ICE STORM       3.945e+09   5.022e+09
## 329             THUNDERSTORM WIND       3.483e+09   4.148e+08
## 201                HURRICANE OPAL       3.173e+09   1.900e+07
## 431              WILD/FOREST FIRE       3.002e+09   1.068e+08
## 144     HEAVY RAIN/SEVERE WEATHER       2.500e+09   0.000e+00
## 346            THUNDERSTORM WINDS       1.736e+09   1.907e+08
## 377    TORNADOES, TSTM WIND, HAIL       1.600e+09   2.500e+06
## 288           SEVERE THUNDERSTORM       1.205e+09   2.000e+05
## 43                        DROUGHT       1.046e+09   1.397e+10
## 151                    HEAVY SNOW       9.326e+08   1.347e+08
## 233                     LIGHTNING       9.287e+08   1.209e+07
## 140                    HEAVY RAIN       6.942e+08   7.334e+08
## 14                       BLIZZARD       6.592e+08   1.121e+08
## 430                    WILD FIRES       6.241e+08   0.000e+00
## 187                    HIGH WINDS       6.083e+08   4.072e+07
## 405                       TYPHOON       6.002e+08   8.250e+05
## 224                     LANDSLIDE       3.246e+08   2.002e+07
## 74                 FLASH FLOODING       3.078e+08   1.512e+07
## 72              FLASH FLOOD/FLOOD       2.725e+08   5.550e+05
## 22                  COASTAL FLOOD       2.596e+08   0.000e+00
## 198                HURRICANE ERIN       2.581e+08   1.360e+08
## 130                     HAILSTORM       2.410e+08   0.000e+00
## 319                   STRONG WIND       1.753e+08   6.495e+07
## 82              FLOOD/FLASH FLOOD       1.740e+08   9.503e+07
## 403                       TSUNAMI       1.441e+08   2.000e+04
## 23               COASTAL FLOODING       1.330e+08   5.600e+04
## 281                RIVER FLOODING       1.163e+08   2.802e+07
## 191               HIGH WINDS/COLD       1.105e+08   7.000e+06
## 87                       FLOODING       1.083e+08   8.856e+06
## 244                   MAJOR FLOOD       1.050e+08   0.000e+00
## 434                     WILDFIRES       1.005e+08   5.000e+05
## 202     HURRICANE OPAL/HIGH WINDS       1.000e+08   1.000e+07
## 174                     HIGH SURF       8.995e+07   0.000e+00
## 59                   EXTREME COLD       6.774e+07   1.313e+09
## 442       WINTER STORM HIGH WINDS       6.000e+07   5.000e+06
## 419          URBAN/SML STREAM FLD       5.831e+07   8.488e+06
## 271                   RECORD COLD       5.600e+07   0.000e+00
## 427            WATERSPOUT/TORNADO       5.111e+07   0.000e+00
## 197               HURRICANE EMILY       5.000e+07   0.000e+00
## 400                TSTM WIND/HAIL       4.434e+07   6.470e+07
## 220              LAKE-EFFECT SNOW       4.011e+07   0.000e+00
## 444                WINTER WEATHER       2.087e+07   1.500e+07
## 24       COASTAL FLOODING/EROSION       2.003e+07   0.000e+00
## 413                   URBAN FLOOD       1.829e+07   9.235e+05
## 53             EROSION/CSTL FLOOD       1.620e+07   0.000e+00
## 20      COASTAL  FLOODING/EROSION       1.500e+07   0.000e+00
## 296                          SNOW       1.483e+07   1.000e+04
## 142          HEAVY RAIN/HIGH SURF       1.350e+07   1.500e+06
## 90                            FOG       1.316e+07   0.000e+00
## 208                           ICE       1.265e+07   0.000e+00
## 147                   HEAVY RAINS       1.229e+07   6.050e+07
## 101                  FROST/FREEZE       1.048e+07   1.094e+09
## 134                     HEAT WAVE       1.046e+07   5.550e+06
## 79             FLOOD & HEAVY RAIN       1.000e+07   0.000e+00
## 169          HEAVY SURF/HIGH SURF       9.870e+06   0.000e+00
## 40                      DENSE FOG       9.674e+06   0.000e+00
## 8          ASTRONOMICAL HIGH TIDE       9.425e+06   0.000e+00
## 422                    WATERSPOUT       9.354e+06   0.000e+00
## 77                   FLASH FLOODS       8.728e+06   0.000e+00
## 435                          WIND       8.694e+06   3.000e+05
## 60        EXTREME COLD/WIND CHILL       8.648e+06   5.000e+04
## 96                  FREEZING RAIN       8.146e+06   0.000e+00
## 3                       TSTM WIND       8.100e+06   0.000e+00
## 39                DAMAGING FREEZE       8.000e+06   2.962e+08
## 54                 EXCESSIVE HEAT       7.754e+06   4.924e+08
## 223               LAKESHORE FLOOD       7.540e+06   0.000e+00
## 188        HIGH WINDS HEAVY RAINS       7.500e+06   1.000e+04
## 46                 DRY MICROBURST       6.733e+06   1.500e+04
## 446            WINTER WEATHER/MIX       6.372e+06   0.000e+00
## 89                         FLOODS       6.000e+06   5.000e+04
## 414                URBAN FLOODING       5.606e+06   3.665e+05
## 50                     DUST STORM       5.549e+06   3.100e+06
## 213              ICE JAM FLOODING       5.516e+06   5.000e+06
## 251              MARINE TSTM WIND       5.421e+06   0.000e+00
## 266                          RAIN       5.300e+06   7.500e+05
## 315             SNOWMELT FLOODING       5.050e+06   0.000e+00
## 92                   FOREST FIRES       5.000e+06   5.000e+05
## 143          HEAVY RAIN/LIGHTNING       5.000e+06   0.000e+00
## 158 HEAVY SNOW/BLIZZARD/AVALANCHE       5.000e+06   0.000e+00
## 159      HEAVY SNOW/FREEZING RAIN       5.000e+06   0.000e+00
## 165                HEAVY SNOWPACK       5.000e+06   0.000e+00
## 190      HIGH WINDS/COASTAL FLOOD       5.000e+06   0.000e+00
## 209                  ICE AND SNOW       5.000e+06   0.000e+00
## 237                LIGHTNING FIRE       5.000e+06   0.000e+00
## 382        TROPICAL STORM ALBERTO       5.000e+06   0.000e+00
## 148          HEAVY RAINS/FLOODING       4.860e+06   3.530e+05
## 385          TROPICAL STORM JERRY       4.600e+06   1.600e+07
## 11                      AVALANCHE       3.722e+06   0.000e+00
## 218              ICE/STRONG WINDS       3.500e+06   0.000e+00
## 230                    LIGHT SNOW       2.513e+06   0.000e+00
## 320                  STRONG WINDS       2.415e+06   5.000e+06
## 373                    TORNADO F1       2.370e+06   0.000e+00
## 95                   FREEZING FOG       2.182e+06   0.000e+00
## 290          SEVERE THUNDERSTORMS       2.000e+06   1.700e+07
## 35                COLD/WIND CHILL       1.990e+06   6.000e+05
## 56                 EXCESSIVE SNOW       1.935e+06   0.000e+00
## 360           THUNDERSTORM WINDSS       1.836e+06   5.955e+04
## 133                          HEAT       1.797e+06   4.015e+08
## 75           FLASH FLOODING/FLOOD       1.750e+06   1.750e+05
## 380           TROPICAL DEPRESSION       1.737e+06   0.000e+00
## 154   HEAVY SNOW AND STRONG WINDS       1.700e+06   0.000e+00
## 374                    TORNADO F2       1.600e+06   0.000e+00
## 160 HEAVY SNOW/HIGH WINDS & FLOOD       1.500e+06   2.000e+04
## 166                    HEAVY SURF       1.440e+06   0.000e+00
## 313                    SNOW/SLEET       1.350e+06   0.000e+00
## 138                     HEAVY MIX       1.305e+06   0.000e+00
## 301            SNOW FREEZING RAIN       1.305e+06   0.000e+00
## 247              MARINE HIGH WIND       1.297e+06   0.000e+00
## 115                   GUSTY WINDS       1.281e+06   2.000e+05
## 260                      MUDSLIDE       1.275e+06   0.000e+00
## 279        RIVER AND STREAM FLOOD       1.200e+06   0.000e+00
## 308            SNOW/FREEZING RAIN       1.200e+06   0.000e+00
## 183              HIGH WIND DAMAGE       1.100e+06   0.000e+00
## 38                      DAM BREAK       1.002e+06   0.000e+00
## 325                  THUNDERSTORM       9.206e+05   1.000e+06
## 63              EXTREME WINDCHILL       7.550e+05   1.700e+07
## 440                         WINDS       6.460e+05   5.050e+05
## 93                         FREEZE       2.050e+05   4.567e+08
## 289     SEVERE THUNDERSTORM WINDS       1.750e+05   2.900e+07
## 61                   EXTREME HEAT       1.150e+05   5.000e+06
## 294                    SMALL HAIL       7.000e+04   2.079e+07
## 265                         OTHER       5.550e+04   1.034e+06
## 100                         FROST       1.500e+04   6.600e+07
## 6             AGRICULTURAL FREEZE       0.000e+00   2.882e+07
## 31        COLD AND WET CONDITIONS       0.000e+00   6.600e+07
## 37                   COOL AND WET       0.000e+00   5.000e+06
## 52                    EARLY FROST       0.000e+00   4.200e+07
## 57              EXCESSIVE WETNESS       0.000e+00   1.420e+08
## 85               FLOOD/RAIN/WINDS       0.000e+00   1.128e+08
## 131                   HARD FREEZE       0.000e+00   1.310e+07
## 406             UNSEASONABLE COLD       0.000e+00   5.100e+06
## 407             UNSEASONABLY COLD       0.000e+00   2.504e+07
## 410               UNSEASONAL RAIN       0.000e+00   1.000e+07
pEcon

plot of chunk unnamed-chunk-1