Skip to content

Instantly share code, notes, and snippets.

@JoFAM
Created November 30, 2017 11:00
Show Gist options
  • Save JoFAM/9e19b08e0e7b12abb1b8b504629ecccb to your computer and use it in GitHub Desktop.
Save JoFAM/9e19b08e0e7b12abb1b8b504629ecccb to your computer and use it in GitHub Desktop.
Calculating the fraction of real GDP lost in hurricane damage for the most costly hurricane years.
# Calculation of hurricane damage as percentage of
# real GDP in the US.
# The data:
# damage taken from:
# https://www.wunderground.com/cat6/2017-us-hurricane-damages-206-billion-highest-record
# real GDP taken from
# https://fred.stlouisfed.org/series/GDPCA
year <- c(2017,1893,2005,1928,1960,2012,1969,1947,1954,1945)
# damage in billion of dollars, adjusted to 2017 dollars
damage <- c(206.2,185.6,151.4,97.7,91.8,77.9,75.1,70.4,64.2,63.0)
# RGDP in 2009 dollars
# for 2017, I have to use the data of 2016
rgdp <- c(16716.164, NA, 14234.243,
1056.555, 3108.707, 15354.627,
4712.483, 1939.443, 2556.850, 2217.790
)
frac <- damage/rgdp*100
id <- order(frac, decreasing = TRUE)
cbind(year, frac)[id,]
## year frac
## [1,] 1928 9.2470340
## [2,] 1947 3.6299082
## [3,] 1960 2.9529962
## [4,] 1945 2.8406657
## [5,] 1954 2.5109021
## [6,] 1969 1.5936397
## [7,] 2017 1.2335366
## [8,] 2005 1.0636323
## [9,] 2012 0.5073389
## [10,] 1893 NA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment