Alfonso Ugarte Ruiz from BBVA research introduced the locproj package: s459204.
The package is very useful, and I will show you how to customize the LP impulse response functions after the estimations. Let us start with data from an ongoing project that links vulnerability to climate risk and fiscal sustainability. I will reproduce the figure below:
Let me start with the estimations of LPs’ impulse response function with locproj:
**# Sustainability gap, fiscal balance - Full Sample
drop if period>2019 // Remove COVID period
by imfcode: egen meanVIX=mean(VIXCLS)
gen VIXdummy = 0
replace VIXdummy = 1 if VIXCLS>meanVIX
locproj fbsusgap vul100 (c.vul100#c.VIXdummy) ///
l.fbsusgap l.vul100 l.CAB l.cpi_tw l.bondsUS_tw ///
l.msciworld_gw l.VIXCLS, ///
h(4) z fe cluster(imfcode) conf(99) ///
lcs((c.vul100#c.VIXdummy)) ///
title(`"Impact of Vulnerability on Sustainability Gap"') ///
save irfname(vul_fbsusgap) noisily ///
vce(bootstrap, reps(200) seed(8425))
graph rename Graph vul_fbsusgap, replace
These data series have been presented in the following blogs:
We can also estimate the impulse response functions for high vulnerability to climate risks:
**# Sustainability gap, fiscal balance - Low Vulnerability
locproj fbsusgap vul100 (c.vul100#c.VIXdummy) ///
l.fbsusgap l.vul100 l.CAB l.cpi_tw l.bondsUS_tw ///
l.msciworld_gw l.VIXCLS if vul100>37.22011, ///
h(4) z fe cluster(imfcode) conf(99) ///
lcs((c.vul100#c.VIXdummy)) ///
title(`"Impact of Vulnerability on Sustainability Gap for High Vulnerability"') ///
save irfname(vul_fbsusgap_high_vul) noisily ///
vce(bootstrap, reps(200) seed(8425))
graph rename Graph vul_fbsusgap_high_vul, replace
Then and, finally, use the twoway command and the result saved by locproj to customize the impulse response functions:
by imfcode: gen N = _n
twoway ///
(rarea vul_fbsusgap_up vul_fbsusgap_lo N, fcolor(green%15) ///
lc(green%7)) ///
(line vul_fbsusgap N, lcolor(blue) lpattern(solid)) ///
(rarea vul_fbsusgap_high_vul_up vul_fbsusgap_high_vul_lo N, ///
fcolor(red%15) lc(red%7)) ///
(line vul_fbsusgap_high_vul N, lcolor(red) lpattern(solid)) ///
if N<=5, xtitle("") yline(0) ///
title(`"Panel LP for Vunerability on Sustainability Gap"') ///
subtitle(`"Vunerability - (shock on c.vul100#c.VIXdummy)"') ///
legend(pos(5) ring(0) ///
label(1 "Full Sample IRF's CI (99% level)") label(2 "Full Sample IRF") ///
label(3 "High Vulnerability IRF's CI (99% level)") ///
label(4 "High Vulnerability IRF") ///
region(lcolor(gray)))
graph export vul_fbsusgap.png, as(png) width(4000) replace