Storm events impact in USA (1950-2011)

Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severe events can result in fatalities, injuries, and property damage, and preventing such outcomes to the extent possible is a key concern. This project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. This database tracks characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, and property damage. This was the second course project for the Reproducible Reasearch course, part of the Data Science Specialization by Johns Hopkins University on Coursera.

Data Processing

We explain how we proceeded with the provided data. First of all, we load the data:

StormData <- read.csv("StormData.csv.bz2") 

Second, we need to explore the data to get a first idea of its structure:

str(StormData)
## '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 ""," Christiansburg",..: 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 ""," CANTON"," TULIA",..: 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","%SD",..: 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 "","\t","\t\t",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ REFNUM    : num  1 2 3 4 5 6 7 8 9 10 ...
head(StormData)
##   STATE__           BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE
## 1       1  4/18/1950 0:00:00     0130       CST     97     MOBILE    AL
## 2       1  4/18/1950 0:00:00     0145       CST      3    BALDWIN    AL
## 3       1  2/20/1951 0:00:00     1600       CST     57    FAYETTE    AL
## 4       1   6/8/1951 0:00:00     0900       CST     89    MADISON    AL
## 5       1 11/15/1951 0:00:00     1500       CST     43    CULLMAN    AL
## 6       1 11/15/1951 0:00:00     2000       CST     77 LAUDERDALE    AL
##    EVTYPE BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END
## 1 TORNADO         0                                               0
## 2 TORNADO         0                                               0
## 3 TORNADO         0                                               0
## 4 TORNADO         0                                               0
## 5 TORNADO         0                                               0
## 6 TORNADO         0                                               0
##   COUNTYENDN END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES
## 1         NA         0                      14.0   100 3   0          0
## 2         NA         0                       2.0   150 2   0          0
## 3         NA         0                       0.1   123 2   0          0
## 4         NA         0                       0.0   100 2   0          0
## 5         NA         0                       0.0   150 2   0          0
## 6         NA         0                       1.5   177 2   0          0
##   INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES
## 1       15    25.0          K       0                                    
## 2        0     2.5          K       0                                    
## 3        2    25.0          K       0                                    
## 4        2     2.5          K       0                                    
## 5        2     2.5          K       0                                    
## 6        6     2.5          K       0                                    
##   LATITUDE LONGITUDE LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1     3040      8812       3051       8806              1
## 2     3042      8755          0          0              2
## 3     3340      8742          0          0              3
## 4     3458      8626          0          0              4
## 5     3412      8642          0          0              5
## 6     3450      8748          0          0              6

We must analyse the data to answer these questions:

1. Across the United States, which types of events (as indicated in the 𝙴𝚅𝚃𝚈𝙿𝙴 variable) are most harmful with respect to population health?

2. Across the United States, which types of events have the greatest economic consequences?

According to that, we select the columns (variables) BGN_DATE, EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP, reducing the size of the dataset:

subset <- StormData[,c("BGN_DATE", "EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")]

Results

Events more harmful to the population

To answer this question, we aggregate (sum) the fatalities and injuries data for the whole time-series for every kind of storm event:

harmful <- aggregate(cbind(FATALITIES, INJURIES) ~ EVTYPE, data = subset, FUN = sum)

Now we make a table and a graph with the Top 20 storm events with highest fatalities and injuries, with decreasing order:

top.fatalities <- harmful[order(-harmful$FATALITIES), ][1:10, 1:2]
top.fatalities
##             EVTYPE FATALITIES
## 834        TORNADO       5633
## 130 EXCESSIVE HEAT       1903
## 153    FLASH FLOOD        978
## 275           HEAT        937
## 464      LIGHTNING        816
## 856      TSTM WIND        504
## 170          FLOOD        470
## 585    RIP CURRENT        368
## 359      HIGH WIND        248
## 19       AVALANCHE        224
top.injuries <- harmful[order(-harmful$INJURIES), ][1:10, c(1,3)]
top.injuries
##                EVTYPE INJURIES
## 834           TORNADO    91346
## 856         TSTM WIND     6957
## 170             FLOOD     6789
## 130    EXCESSIVE HEAT     6525
## 464         LIGHTNING     5230
## 275              HEAT     2100
## 427         ICE STORM     1975
## 153       FLASH FLOOD     1777
## 760 THUNDERSTORM WIND     1488
## 244              HAIL     1361
par(mfrow = c(1, 2), mar = c(12, 8, 3, 6), mgp = c(3, 1, 0), cex = 0.6)
barplot(top.fatalities$FATALITIES, las = 3, names.arg = top.fatalities$EVTYPE, ylab = "Fatalities", col="red", main = "Top 10 events with highest fatalities in USA (1950-2011)")
barplot(top.injuries$INJURIES, las = 3, names.arg = top.injuries$EVTYPE, ylab = "Fatalities", col="blue", main = "Top 10 events with highest injuries in USA (1950-2011)")

_config.yml

As graphics show, Tornados are the most harmful events (fatalities & injuries) with a notable difference with the rest of events.

Events with the greatest economic impact

PROPDMGVAL column contains the Property Damage Value, but with differents units, wich are specified in column PROPDMGEXP (Property Damage Exponents):

unique(subset$PROPDMGEXP)
##  [1] K M   B m + 0 5 6 ? 4 2 3 h 7 H - 1 8
## Levels:  - ? + 0 1 2 3 4 5 6 7 8 B h H K m M

So we need to convert the data to the same data units, from exponents to numerical values. We generate a new column with numerical values for exponents (PROPDMGEXPVAL), and then we multiply the original damage values with the exponents values to obtain the total damage value (PROPDMGVAL).

# Transformation of letters/numbers to values
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "K"] <- 1000
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "M"] <- 1e+06
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == ""] <- 1
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "B"] <- 1e+09
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "m"] <- 1e+06
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "+"] <- 0
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "0"] <- 1
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "5"] <- 1e+05
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "6"] <- 1e+06
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "?"] <- 0
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "4"] <- 10000
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "2"] <- 100
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "3"] <- 1000
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "h"] <- 100
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "7"] <- 1e+07
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "H"] <- 100
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "-"] <- 0
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "1"] <- 10
subset$PROPDMGEXPVAL[subset$PROPDMGEXP == "8"] <- 1e+08

#Calculates the real value for the damage

subset$PROPDMGVAL <- subset$PROPDMG * subset$PROPDMGEXPVAL

The same procedure for the crop damage:

unique(subset$CROPDMGEXP)
## [1]   M K m B ? 0 k 2
## Levels:  ? 0 2 B k K m M
subset$CROPEXPVAL[subset$CROPDMGEXP == "M"] <- 1e+06
subset$CROPEXPVAL[subset$CROPDMGEXP == "K"] <- 1000
subset$CROPEXPVAL[subset$CROPDMGEXP == "m"] <- 1e+06
subset$CROPEXPVAL[subset$CROPDMGEXP == "B"] <- 1e+09
subset$CROPEXPVAL[subset$CROPDMGEXP == "?"] <- 0
subset$CROPEXPVAL[subset$CROPDMGEXP == "0"] <- 1
subset$CROPEXPVAL[subset$CROPDMGEXP == "k"] <- 1000
subset$CROPEXPVAL[subset$CROPDMGEXP == "2"] <- 100
subset$CROPEXPVAL[subset$CROPDMGEXP == ""] <- 1

subset$CROPDMGVAL <- subset$CROPDMG * subset$CROPEXPVAL

Now we aggregate the total damages, as requested:

damage <- aggregate(cbind(PROPDMGVAL, CROPDMGVAL) ~ EVTYPE, data = subset, FUN = sum)

As we did before for harmful events, we select the TOP 10 damage values:

top.propdmg <- damage[order(-damage$PROPDMGVAL), ][1:10, 1:2]
top.propdmg
##                EVTYPE   PROPDMGVAL
## 170             FLOOD 144657709807
## 411 HURRICANE/TYPHOON  69305840000
## 834           TORNADO  56947380616
## 670       STORM SURGE  43323536000
## 153       FLASH FLOOD  16822673978
## 244              HAIL  15735267513
## 402         HURRICANE  11868319010
## 848    TROPICAL STORM   7703890550
## 972      WINTER STORM   6688497251
## 359         HIGH WIND   5270046260
top.cropdmg <- damage[order(-damage$CROPDMGVAL),][1:10, c(1,3)]
top.cropdmg
##                EVTYPE  CROPDMGVAL
## 95            DROUGHT 13972566000
## 170             FLOOD  5661968450
## 590       RIVER FLOOD  5029459000
## 427         ICE STORM  5022113500
## 244              HAIL  3025954473
## 402         HURRICANE  2741910000
## 411 HURRICANE/TYPHOON  2607872800
## 153       FLASH FLOOD  1421317100
## 140      EXTREME COLD  1292973000
## 212      FROST/FREEZE  1094086000

Now, the graphics:

par(mfrow = c(1, 2), mar = c(12, 10, 3, 8), mgp = c(3, 1, 0), cex = 0.6)
barplot(top.propdmg$PROPDMGVAL/10^6, las = 3, names.arg = top.propdmg$EVTYPE, ylab = "Cost (millions)", col="orange", main = "Top 10 events with highest property damage (1950-2011)")
barplot(top.cropdmg$CROPDMGVAL/10^6, las = 3, names.arg = top.cropdmg$EVTYPE, ylab = "Cost (millions)", col="green", main = "Top 10 events with highest crop damage (1950-2011)")

_config.yml

Flood is the event that causes the greatest damage to properties, meanwhile drought is the event that causes the greates crop damage.

Written on January 26, 2016