Sypnosis

Storms and other severe weather events, including hurricanes, tornadoes, and severe thunderstorms, have profound impacts on public health and economy. The severe weathers that takes the form of disasters could often lead to significant damage of the infrastructures, displacement of populations, and disruption in healthcare services.The analysis of the major storms and weather events could provide a valuable information on which kind of storms have significant impact on public health and economy, their occurrence location and characteristics. So, to find out the major storms and severe weather events that were more destructive in United States, we use the National Oceanic and Atmospheric Administration (NOAA) Storm Database. The Tornado was found to be more harmful with respect to population health, whereas flood has the greatest economic consequence.

Objective

The basic motivation is to explore the NOAA Storm Database, use R to analyse the data, and answer the following two basic questions about severe weather events.

  1. Across the United States, which types of events are most harmful with respect to population health?

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

NOAA Storm Data and Data Processing

The NOAA Storm Database tracks the characteristics of major storms and weather events in United States. The characteristics include the time and location of their occurrence, estimation of the loss of lives (fatalities and injury) and property (infrastructures and crops) etc. To find out the major weather events that has huge impact on property and health, here the dataset from NOAA Storm Database is used which consist of the data from 1950 to 2011.

1. Download the data

Now let’s start from downloading the raw data in R. First, install and load the required libraries. Here the libraries dplyr , tidyr and ggplot are used.

The code below will check whether the library are already installed. If not it will install the library and load to the system memory.

packages <- c("dplyr", "tidyr", "ggplot2")
installed_packages <- packages %in% rownames(installed.packages())
if (any(installed_packages == FALSE)) {
        install.packages(packages[!installed_packages])
}
invisible(lapply(packages, library, character.only = TRUE))
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Download the storm data. The data is available from Storm Data There are also some documentation available Storm Data Documentation and National Climatic Data Center Storm Events FAQ to understand the data, and variables used to store the data.

The storm data is stored in standard comma-separated-value format compressed with bzip2 algorithm.

url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(url, "stormdata.csv.bz2")

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

2. Preprocessing of data

There are total 902297 observations with 37 variables. In this case, the variables necessary are only the variables related to the weather event type (EVTYPE); health related fatalities FATALITIES and injuries INJURIES; economic related - property damage PROPDMG and PROPDMGEXP, and crop damage CROPDMG and CROPDMGEXP. We will first subset the data for these variables.

storm_data <- storm %>%
        select(c("BGN_DATE", "EVTYPE", "FATALITIES", "INJURIES", "PROPDMG",
                 "PROPDMGEXP", "CROPDMG", "CROPDMGEXP"))

To analyse the property damage we need to asses the total loss in monetary value.But these are indexed with different letters in PROPDMGEXP and CROPDMGEXP.

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"

First, we calculate the total property and crops loss in monetary value. The letters H, K, M, B represents the numbers in hundreds, thousands, millions and billions respectively, and all other values represent the exponent of value 1.

storm_data <- storm_data %>%
        mutate(PROPDMG.COST = ifelse(PROPDMGEXP == "H", PROPDMG*(10^2),
                                     ifelse (PROPDMGEXP == "K", PROPDMG*(10^3),
                                             ifelse(PROPDMGEXP == "M", PROPDMG*(10^6),
                                                    ifelse(PROPDMGEXP == "B", PROPDMG*(10^9),
                                                           PROPDMG*(10^0))))),
               CROPDMG.COST = ifelse(CROPDMGEXP == "H", CROPDMG*(10^2),
                                     ifelse (CROPDMGEXP == "K", CROPDMG*(10^3),
                                             ifelse(CROPDMGEXP == "M", CROPDMG*(10^6),
                                                    ifelse(CROPDMGEXP == "B", CROPDMG*(10^9),
                                                           CROPDMG*(10^0))))))

To understand total impacts on human health and economy, we will also calculate the total cases of fatalities and injuries taking their sum and total property loss taking the sum of property and crops loss.

storm_data <- storm_data %>%
        mutate(TOTAL.CASES = FATALITIES + INJURIES,
               TOTAL.LOSS = PROPDMG.COST + CROPDMG.COST)

Let’s check the final data prepared for analysis.

head(storm_data)
##             BGN_DATE  EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG
## 1  4/18/1950 0:00:00 TORNADO          0       15    25.0          K       0
## 2  4/18/1950 0:00:00 TORNADO          0        0     2.5          K       0
## 3  2/20/1951 0:00:00 TORNADO          0        2    25.0          K       0
## 4   6/8/1951 0:00:00 TORNADO          0        2     2.5          K       0
## 5 11/15/1951 0:00:00 TORNADO          0        2     2.5          K       0
## 6 11/15/1951 0:00:00 TORNADO          0        6     2.5          K       0
##   CROPDMGEXP PROPDMG.COST CROPDMG.COST TOTAL.CASES TOTAL.LOSS
## 1                   25000            0          15      25000
## 2                    2500            0           0       2500
## 3                   25000            0           2      25000
## 4                    2500            0           2       2500
## 5                    2500            0           2       2500
## 6                    2500            0           6       2500

Results

1. Across the United States, which types of events are most harmful with respect to population health?

There are 985 types of weather events in the storm data. Here we check for first ten unique values only. We can print all values just by running unique(storm_data$EVTYPE).

unique_evtype <- unique(storm_data$EVTYPE)
head(unique_evtype, 10)
##  [1] "TORNADO"                   "TSTM WIND"                
##  [3] "HAIL"                      "FREEZING RAIN"            
##  [5] "SNOW"                      "ICE STORM/FLASH FLOOD"    
##  [7] "SNOW/ICE"                  "WINTER STORM"             
##  [9] "HURRICANE OPAL/HIGH WINDS" "THUNDERSTORM WINDS"

So we will calculate the total fatalities, injuries and total cases for each weather type and identify the top ten weather events that are most harmful to the population health based on total cases.

storm_dataHealth <- storm_data %>%
        select(c("EVTYPE", "FATALITIES", "INJURIES", "TOTAL.CASES")) %>%
        group_by(EVTYPE) %>%
        summarise_all(list(sum)) %>%
        arrange(desc(TOTAL.CASES)) %>%
        slice(1:10)
head(storm_dataHealth)
## # A tibble: 6 × 4
##   EVTYPE         FATALITIES INJURIES TOTAL.CASES
##   <chr>               <dbl>    <dbl>       <dbl>
## 1 TORNADO              5633    91346       96979
## 2 EXCESSIVE HEAT       1903     6525        8428
## 3 TSTM WIND             504     6957        7461
## 4 FLOOD                 470     6789        7259
## 5 LIGHTNING             816     5230        6046
## 6 HEAT                  937     2100        3037

Now let’s plot the result. To plot first transform the data to long form from matrix form using tidyr, and then plot by using ggplot2 library.

storm_dataHealth_long <- tidyr::gather(storm_dataHealth, key = "variable", value = "value", -EVTYPE)
ggplot(data = storm_dataHealth_long,
       aes(x = reorder(EVTYPE, -value), y = value/10^3, fill =  variable)) +
        geom_bar(stat = "identity", position = "dodge") +
        theme_bw() +
        labs(x = "Event Type",
             y = expression("No. of People (in"~10^3~")")) +
        ggtitle("Top 10 most harmful weather events with respect to population health") +
        scale_fill_manual(values = c("FATALITIES" = "blue", "INJURIES"="orange",
                                     "TOTAL.CASES"="red"),
                          labels= c("FATALITIES" = "FATALITY CASES", "INJURIES"="INJURY CASES",
                                    "TOTAL.CASES"="TOTAL CASES")) +
        theme(axis.text.x = element_text(angle = 45, hjust = 1),
              plot.title = element_text(hjust = 0.5),
              legend.title = element_blank(),
              legend.position = c(.8,.8))

The above plot shows the top ten most harmful weather events for population health. Among them TORNADO is the most harmful event across the united states.

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

To assess the most harmful weather events with greatest economic consequence, we will calculate the property dame costs, crop damage costs and their total for each weather type and identify the top ten weather events that are most disastrous.

storm_dataProp <- storm_data %>%
        select(c("EVTYPE", "PROPDMG.COST", "CROPDMG.COST", "TOTAL.LOSS")) %>%
        group_by(EVTYPE) %>%
        summarise_all(list(sum)) %>%
        arrange(desc(TOTAL.LOSS)) %>%
        slice(1:10)
head(storm_dataProp)
## # A tibble: 6 × 4
##   EVTYPE             PROPDMG.COST CROPDMG.COST    TOTAL.LOSS
##   <chr>                     <dbl>        <dbl>         <dbl>
## 1 FLOOD             144657709807    5661968450 150319678257 
## 2 HURRICANE/TYPHOON  69305840000    2607872800  71913712800 
## 3 TORNADO            56925660790.    414953270  57340614060.
## 4 STORM SURGE        43323536000          5000  43323541000 
## 5 HAIL               15727367548.   3025537890  18752905438.
## 6 FLASH FLOOD        16140812067.   1421317100  17562129167.

Now let’s plot the above data for visualization of which weather event is more disastrous.

storm_dataProp_long <- tidyr::gather(storm_dataProp, key = "variable", value = "value", -EVTYPE)
ggplot(data = storm_dataProp_long,
       aes(x = EVTYPE, y = value/10^9, fill =  variable)) +
        geom_bar(stat = "identity", position = "dodge") +
        theme_bw() +
        labs(x = "Event Type",
             y = expression("Total Monetary Loss (in"~10^9~"$)")) +
        ggtitle("Top 10 most disastrous weather events with great economic consequence") +
        scale_fill_manual(values = c("TOTAL.LOSS" = "red", "PROPDMG.COST"="blue","CROPDMG.COST"="orange"),
                          labels= c("TOTAL.LOSS" = "Total Loss", 
                          "PROPDMG.COST"="Property Damage", "CROPDMG.COST"="Crop Damage")) +
        theme(axis.text.x = element_text(angle = 45, hjust = 1),
              plot.title = element_text(hjust = 0.5),
              legend.title = element_blank(),
              legend.position = c(.8,.8))

From the above figure we see that the FLOOD causes the highest economic loss. Hurricane/typhoon, tornado and storm surge are also the causes of biggest property and crop damage consequences.

Conclusion

Based on the above analysis, tornadoes have the biggest human health impact whereas flood, hurricane, tornado and storm surge are the major weather events for property and crops damage and economic loss. So, resources should be directed in developing the better infrastructure and early warning systems dealing with these events for the safety of population and property.

References

  1. Storm Data

https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2)

  1. National Weather Service Storm Data Documentation

https://d396qusza40orc.cloudfront.net/repdata%2Fpeer2_doc%2Fpd01016005curr.pdf

  1. National Climatic Data Center Storm Events FAQ

https://d396qusza40orc.cloudfront.net/repdata%2Fpeer2_doc%2FNCDC%20Storm%20Events-FAQ%20Page.pdf