Feeling the Heat: Heatmaps for Vulnerability Scores

After a series of blogs where I explained the functioning of the DBnomics package: https://www.jamelsaadaoui.com/?s=dbnomics

I will show how to directly download the Vulnerability Index built by the ND-GAIN: https://gain.nd.edu/our-work/country-index/methodology

**# Import the data

dbnomics import, provider(ND_GAIN) ///
 dataset(vulnerability) clear

rename   value VUL
destring VUL, replace force 
split    series_name, parse(–)
encode   series_name2, generate(cn)
*keep     cn country period VUL
order    cn country period VUL

kountry  country, from(iso3c) to(imfn) m
list     cn country _IMFN_ MARKER /// 
         if period == 2020 & MARKER == 0
drop     if MARKER == 0
rename   _IMFN_ imfcode
order    cn country imfcode period
keep     cn country imfcode period VUL
drop     if imfcode==. 

xtset    imfcode period

save     VUL_ND.dta, replace

Now, I will build on the Medium blog written by Asjad Naqvi and use Ben Jann’s package heatplot for the highly vulnerable countries

**# Heat map

encode   country, generate(CN)

*** install the packages
ssc install heatplot, replace
help heatplot  // see for the documentation and examples

sum VUL, detail

format VUL %4.2f

by imfcode: egen mean_VUL = mean(VUL)

drop if mean_VUL< .5174853

summ period
  local x1 = `r(min)'
  local x2 = `r(max)'
heatplot VUL i.cn period if mean_VUL> .5174853 , ///
 yscale(noline) ///
 ylabel(, nogrid labsize(*0.5)) ///
 xlabel(`x1'(5)`x2', labsize(*0.75) angle(vertical) nogrid) ///
 color(inferno, reverse) ///  
 levels(8) ///
  ramp(right  space(14)  format(%4.2f)) ///
  p(lcolor(black%10) lwidth(*0.1)) ///
  ytitle("") ///
  xtitle("", size(vsmall)) ///
  xdiscrete name(vulQ3, replace) ///
 title("Vulnerability Index (above Q3)") ///
  note("Data source: Notre Dame Global Adaptation Initiative.", ///

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.