SYNOPSIS

The study utilizes the Database U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database to determine which type of natural calamity events are most harmful with respect to population health and economic costs/ damages. Specifically, the study aims to answer the following questions:

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

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

The estimated variables in evaluating health impacts are fatalities injuries and found that Tornados is the most harmful event with regard to US health population. While, with the use of property damage and crop damage variables, the study found that flood has the highest economic impact


INTRODUCTION

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.

Data

The data for this assignment come in the form of a comma-separated-value file compressed via the bzip2 algorithm to reduce its size. You can download the file from the course web site:

There is also some documentation of the database available. Here you will find how some of the variables are constructed/defined.

The events in the database start in the year 1950 and end in November 2011. In the earlier years of the database there are generally fewer events recorded, most likely due to a lack of good records. More recent years should be considered more complete.


DATA PROCESSING

Here the study details how the data is processed prior to analysis.

  1. Setting up (libraries and settings)
# Settings and packages

knitr::opts_chunk$set(echo = TRUE, warning = FALSE, fig.width = 10, fig.height = 5,
                      fig.keep = 'all' ,fig.path = 'figures\ ', dev = 'png')

library(dplyr)
## 
## 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
library(ggplot2)
library(data.table)
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
  1. Loading Data
# Reading data
stormdata<-read.csv("./repdata_data_StormData.csv/repdata_data_StormData.csv", header=TRUE, sep=",")
  1. Assessing data
# Assessing data
colnames(stormdata)
##  [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"
str(stormdata)
## 'data.frame':    902297 obs. of  37 variables:
##  $ STATE__   : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ BGN_DATE  : chr  "4/18/1950 0:00:00" "4/18/1950 0:00:00" "2/20/1951 0:00:00" "6/8/1951 0:00:00" ...
##  $ BGN_TIME  : chr  "0130" "0145" "1600" "0900" ...
##  $ TIME_ZONE : chr  "CST" "CST" "CST" "CST" ...
##  $ COUNTY    : num  97 3 57 89 43 77 9 123 125 57 ...
##  $ COUNTYNAME: chr  "MOBILE" "BALDWIN" "FAYETTE" "MADISON" ...
##  $ STATE     : chr  "AL" "AL" "AL" "AL" ...
##  $ EVTYPE    : chr  "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
##  $ BGN_RANGE : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ BGN_AZI   : chr  "" "" "" "" ...
##  $ BGN_LOCATI: chr  "" "" "" "" ...
##  $ END_DATE  : chr  "" "" "" "" ...
##  $ END_TIME  : chr  "" "" "" "" ...
##  $ 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   : chr  "" "" "" "" ...
##  $ END_LOCATI: chr  "" "" "" "" ...
##  $ 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: chr  "K" "K" "K" "K" ...
##  $ CROPDMG   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ CROPDMGEXP: chr  "" "" "" "" ...
##  $ WFO       : chr  "" "" "" "" ...
##  $ STATEOFFIC: chr  "" "" "" "" ...
##  $ ZONENAMES : chr  "" "" "" "" ...
##  $ 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   : chr  "" "" "" "" ...
##  $ REFNUM    : num  1 2 3 4 5 6 7 8 9 10 ...
# Setting it as data.table
stormdata<-as.data.table (stormdata)
  1. Subsetting data of interest Health and Economic data of for the analysis are as follows:
# Subsetting data
stormdata_select <-stormdata[, c('EVTYPE', 'FATALITIES', 'INJURIES', 'PROPDMG', 'PROPDMGEXP', 'CROPDMG', 'CROPDMGEXP')]

stormdata_select<- as.data.table(stormdata_select)
stormdata_select <- stormdata_select[(EVTYPE != "?" & (INJURIES > 0 | FATALITIES > 0 | PROPDMG > 0 | CROPDMG > 0)),c("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")]
  1. Converting property damage and crop damage values using exponents
stormdata_select$PROPDMG_AMT<- with(stormdata_select,
    ifelse(PROPDMGEXP %in% c("k","K"), PROPDMG*1000,
        ifelse(PROPDMGEXP %in% c("m","M"), PROPDMG*1000000,
               ifelse(PROPDMGEXP %in% c("b","B"), PROPDMG*1000000000,
                      0)
        )
    )
)


stormdata_select$CROPDMG_AMT<- with(stormdata_select,
    ifelse(CROPDMGEXP %in% c("k","K"), CROPDMG*1000,
        ifelse(CROPDMGEXP %in% c("m","M"), CROPDMG*1000000,
               ifelse(CROPDMGEXP %in% c("b","B"), CROPDMG*1000000000,
                      0)
        )
    )
)

Results

1. Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health

Results shows that Tornados are the most harmful calamity with documented fatalities of 5633 and injuries of 91,346 with a total of 96,979. The top 10 most harmful calamity ar as follows, (1) Tornado, (2) Excessive heat, (3) TSTM wind, (4) Flood, (5) Lightning, (6) Heat, (7) Flash Flood, (8) Ice Storm, (9) Thunderstorm wind, (10) Winter Storm. Below details further information on these findings.

Deriving Ranked top 10 event type
healthimpact<-stormdata_select[, .(fatalities=sum(FATALITIES), injuries=sum(INJURIES),totalhealthimpact=sum(FATALITIES) + sum(INJURIES)), by=.(EVTYPE)]

healthimpact <-healthimpact[order(-totalhealthimpact),]
dim(healthimpact)
## [1] 487   4
# Getting top 10 
healthimpact <- healthimpact[1:10,]
healthimpact
##                EVTYPE fatalities injuries totalhealthimpact
##                <char>      <num>    <num>             <num>
##  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
##  7:       FLASH FLOOD        978     1777              2755
##  8:         ICE STORM         89     1975              2064
##  9: THUNDERSTORM WIND        133     1488              1621
## 10:      WINTER STORM        206     1321              1527
# The table below details the Top 10 Most Harmful Natural Calamity Type based on its Health Impacts.
Bar plot of Top 10 Most Impactful Natural Calamity Type based on its Health Impacts
# Bar plot
ggplot(healthimpact, aes(x=reorder(EVTYPE, -totalhealthimpact), y=totalhealthimpact)) + 
    geom_bar(stat = "identity") + 
    theme_minimal() + 
    theme(axis.text.x = element_text(angle = 45, hjust=1)) + 
    xlab("Natural Calamity Type") +
    ylab("Total Number of Injuries Fatalities") +
    ggtitle("Top 10 Most Impactful Natural Calamity Type based on its Health Impacts")

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

Results shows that Floods has the highest negative economic impact in value amounting to 5.7 billion USD, 144.7 billion USD with a total of 150.3 billion USD . The top 10 most harmful calamity ar as follows, (1) Flood, (2) Hurricane/typhoon, (3) Tornado, (4) Storm Surge, (5) Hail, (6) Flash Flood, (7) Drought, (8) Hurricane, (9) River Flood, (10) Ice Storm. Below details further information on these findings.

Deriving Ranked top 10 event type
econimpact <- stormdata_select[, .(CROPAMT=sum(CROPDMG_AMT), PROPAMT=sum(PROPDMG_AMT) ,totaleconimpact=sum(CROPDMG_AMT)+sum(stormdata_select$PROPDMG_AMT)), by=.(EVTYPE)]

# Getting Total of economic impacts
econimpact$total<-econimpact$CROPAMT + econimpact$PROPAMT

econimpact <-econimpact[order(-total),]

# Getting top 10 
econimpact <- econimpact[1:10,]
dim(econimpact)
## [1] 10  5
# Convert total economic impact to billion USD
econimpact$total <- econimpact$total/1000000000
econimpact$CROPAMT <- econimpact$CROPAMT/1000000000
econimpact$PROPAMT <- econimpact$PROPAMT/1000000000
summary(econimpact$total)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   8.967  14.712  18.160  40.797  53.845 150.320
econimpact<-econimpact[,c(1,2,3,5)]
econimpact
##                EVTYPE    CROPAMT    PROPAMT      total
##                <char>      <num>      <num>      <num>
##  1:             FLOOD  5.6619684 144.657710 150.319678
##  2: HURRICANE/TYPHOON  2.6078728  69.305840  71.913713
##  3:           TORNADO  0.4149531  56.937160  57.352114
##  4:       STORM SURGE  0.0000050  43.323536  43.323541
##  5:              HAIL  3.0259544  15.732267  18.758221
##  6:       FLASH FLOOD  1.4213171  16.140812  17.562129
##  7:           DROUGHT 13.9725660   1.046106  15.018672
##  8:         HURRICANE  2.7419100  11.868319  14.610229
##  9:       RIVER FLOOD  5.0294590   5.118945  10.148404
## 10:         ICE STORM  5.0221135   3.944928   8.967041
Bar plot of Top 10 Most Impactful Natural Calamity Type based on its Health Impacts
# Bar plot
ggplot(econimpact, aes(x=reorder(EVTYPE, -total), y=total)) + 
    geom_bar(stat = "identity") + 
    theme_minimal() + 
    theme(axis.text.x = element_text(angle = 45, hjust=1)) + 
    xlab("Natural Calamity Type") +
    ylab("Total Costs/Damages (in billion USD)") +
    ggtitle("Top 10 Most Impactful Natural Calamity Type based on its Economic Impacts")