The effect of weather events on population across the United States

This analysis involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. The extracted data was collected between 1950 and 2011. In the analysis we focused on identifying which weather events most affected the population health using the fatalities and injuries records and assessing the damage to crop and property using the provided data.

The data for the analysis can be downloaded from Storm Data

Some columns of interest in the dataset we have used for the analysis.

Data Processing

In this section, there code for reading data, extracting columns of interest and some data cleaning on columns for analysis.

Then cleaning the PROPDMGEXP and CROPDMGEXP columns that were entered in different formats. This is harmonized using standard exponential notations
“H”, “h” = 2, “K”, “k” = 3, “M”, “m” = 6, “B”, “b” = 9 and for other un identified symbols, 0 was assigned to these values.

data_loc <- "inputs/StormData.csv"

df_storm_data <- read_csv(data_loc)

columns_to_keep <- c("STATE", "COUNTY", "COUNTYNAME", "EVTYPE", "FATALITIES", 
                     "INJURIES", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")

df_storm_data_extract <- df_storm_data %>% 
  select(any_of(columns_to_keep)) %>% 
  mutate(PROPDMGEXP = case_when(is.na(PROPDMGEXP)|PROPDMGEXP %in% c("+", "-", "?") ~ "0",
                                PROPDMGEXP %in% c("H", "h") ~ "2",
                                PROPDMGEXP %in% c("K", "k") ~ "3",
                                PROPDMGEXP %in% c("M", "m") ~ "6",
                                PROPDMGEXP %in% c("B", "b") ~ "9",
                                TRUE ~ PROPDMGEXP),
         CROPDMGEXP = case_when(is.na(CROPDMGEXP)|CROPDMGEXP %in% c("+", "-", "?") ~ "0",
                                CROPDMGEXP %in% c("H", "h") ~ "2",
                                CROPDMGEXP %in% c("K", "k") ~ "3",
                                CROPDMGEXP %in% c("M", "m") ~ "6",
                                CROPDMGEXP %in% c("B", "b") ~ "9",
                                TRUE ~ CROPDMGEXP)
         )

Results

Weather events most harmful with respect to population health

We have used fatalities and injuries to estimate this. Since the categories of events are many, we have focused calculated the total events by category and filtered only events that affected atleast 1000 people (fatalities or injuries)

# total fatalities or injuries by event type
df_effect_on_popln_health <- df_storm_data_extract %>% 
  filter(!EVTYPE %in% c("?")) %>% 
  group_by(EVTYPE) %>% 
  summarise(total_fatalities = sum(FATALITIES, na.rm = TRUE),
            total_injuries = sum(INJURIES, na.rm = TRUE)) 

# top 10 events with highest fatalities
df_effect_on_popln_health_fat <- df_effect_on_popln_health %>% 
  arrange(desc(total_fatalities)) %>% 
  head(10)
  
# top 10 events with highest injuries
df_effect_on_popln_health_inj <- df_effect_on_popln_health %>% 
  arrange(desc(total_injuries)) %>% 
  head(10)

# create a graph to illustrate the fatalities and injuries

par(mfrow = c(1,2), mar=c(8,4,3,2), oma=c(4,2,2,2), cex=0.8)

barplot(df_effect_on_popln_health_fat$total_fatalities, 
        names.arg = df_effect_on_popln_health_fat$EVTYPE, 
        las=2, 
        cex.names=0.6,
        cex.main=0.8,
        cex.axis=0.8,
        cex.sub=0.8,
        col = 2,
        ylab = "Total fatalities", main = "Top 10 events with highest fatalities" )

barplot(df_effect_on_popln_health_inj$total_injuries, 
        names.arg = df_effect_on_popln_health_inj$EVTYPE, 
        las=2, 
        cex.names=0.6,
        cex.main=0.8,
        cex.axis=0.8,
        cex.sub=0.8,
        col = 2,
        ylab = "Total injuries", main = "Top 10 events with highest injuries" )

Event type related with highest number of fatalities : TORNADO with estimated number of fatilities of : 5633

Event type related with highest number of injuries : TORNADO with estimated injuries of : 91346

Weather events with the greatest economic consequences

We used the property damage and crop damage related columns to estimate the total loss in USD

# calculate total damages for property and crops per event type
df_econ_effects <- df_storm_data_extract %>% 
  mutate(prop_damage = as.numeric(PROPDMG) * 10^as.numeric(PROPDMGEXP),
         crop_damage = as.numeric(CROPDMG) * 10^as.numeric(CROPDMGEXP)) %>% 
  group_by(EVTYPE) %>% 
  summarise(total_damage_property = sum(prop_damage, na.rm = TRUE),
            total_damage_crop = sum(crop_damage, na.rm = TRUE))

# get top to event types with highest property loss
df_econ_effects_property <- df_econ_effects %>% 
  arrange(desc(total_damage_property)) %>%
  head(10)

# get top to event types with highest crop loss
df_econ_effects_crop <- df_econ_effects %>% 
  arrange(desc(total_damage_crop)) %>%
  head(10)


# graph to illustrate the property and crop damages

par(mfrow = c(1,2), mar=c(8,4,3,2), oma=c(4,2,2,2), cex=0.8)

barplot(df_econ_effects_property$total_damage_property, 
        names.arg = df_econ_effects_property$EVTYPE, 
        las=2, 
        cex.names=0.6,
        cex.main=0.8,
        cex.axis=0.8,
        cex.sub=0.8,
        col = 2,
        main = "Top 10 event types with highest property losses (USD)" )

barplot(df_econ_effects_crop$total_damage_crop, 
        names.arg = df_econ_effects_crop$EVTYPE, 
        las=2, 
        cex.names=0.6,
        cex.main=0.8,
        cex.axis=0.8,
        cex.sub=0.8,
        col = 2,
        main = "Top 10 event types with highest crop losses (USD)" )

Event type related with highest property damages : FLOOD with estimated damages of : 144657709807 USD

Event type related with highest crop damages : DROUGHT with estimated damages of : 13972566000 USD