Plot all Impulse Response Functions with their Impulses and Responses beautifully with ggplot2.
You can install the released version of beautyIRF
from CRAN with:
#install.packages("ggIRF") # not yet supported
And the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("markushhh/ggIRF")
High resolution will come when saving the graphs.
library("FredApi")
library("vars")
library("ggIRF")
UK <- get_symbols("AURUKM") # Unemployment Rate in the United Kingdom
ITALY <- get_symbols("LRHUTTTTITM156S") # Harmonized Unemployment Rate in Italy
FRANCE <- get_symbols("LRHUTTTTFRM156S") # Harmonized Unemployment Rate in France
head(UK)
#> [,1]
#> 1855-01-01 3.42
#> 1855-02-01 4.04
#> 1855-03-01 4.20
#> 1855-04-01 4.14
#> 1855-05-01 3.64
#> 1855-06-01 4.07
# same time frame
UK <- UK["2000-01-01::2016-01-01"]
ITALY <- ITALY["2000-01-01::2016-01-01"]
FRANCE <- FRANCE["2000-01-01::2016-01-01"]
x <- data.frame(UK, ITALY, FRANCE)
VAR1 <- VAR(x, lag.max = 12, type = "cons")
irf <- irf(VAR1, n.ahead = 20)
autoplot(irf, file_name = "IRF", device = "png")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.