Economic Policy Uncertainty data made easy in R

Lingbing Feng

2020-04-09

Economic Policy Uncertainty data

get_epu() function collects the EPU data and outputs an xts object. The required argument is region which is a character indicating the region of EPU data you need. By default, it collects all regions.

The data collection is in real time and normally takes about several seconds to download.

library(epuR)
library(dygraphs)
all_data <- get_EPU()
dygraph(all_data)

As it is a xts object, so dygraph can be directly applied for interactive plots.

dygraph(all_data)

If you need EPU for a specific region, use region = argument:

china_epu <- get_EPU(region = "China")
dygraph(china_epu)

Another way to get country level data is to directly manipulate the all_data object:

china_data <- all_data$China
dygraph(china_data)

The difference is that using region will take care of the NA values so there is no large white area in the plot. However, it is not a problem in xts, just delete the NAs.

dygraph(na.omit(china_data))

Trade Policy Uncertainty (TPU) data

The US TPU data is one of the category-specific EPU indices developed in the original paper by Baker et al. (2016). “It reflects the frequency of articles in American newspapers that discuss policy-related economic uncertainty and also contain one or more references to trade policy”. To get the US TPU data:

us_tpu <- get_TPU(region = "US")
dygraph(us_tpu)

China TPU index is constructed by Steven J. Davis, Dingqian Liu and Xuguang S. Sheng using the Renmin Daily and the Guangming Daily.

To get the China TPU:

china_tpu <- get_TPU("China")
dygraph(china_tpu)

Japan TPU is also available, to get Japan TPU:

jap_tpu <- get_TPU("Japan")
dygraph(jap_tpu)

The japan TPU data also contains EPU, FPU, MPUI, and ERPU. If you need TPU, simply:

dygraph(jap_tpu$TPU)

US Equity Market Volatility Index

The default get_emv collects all categories constituting the index and the output can be quite messy. If only the overall EMV is in need, set all = FALSE. Also, it is suggested to keep the default all = TRUE and manipulate the xts output as needed.

emv_data <- get_EMV(all = F)
dygraph(emv_data)

World Unvcertainty Index (WUI) data

The official WUI data set excel file contains several sheets, and the name of which becomes the argument option of the get_wui() function. They are:

Therefore, to get the overall WUI:

wui_overall <- get_WUI("F1")
dygraph(wui_overall)

To get the World Trade Uncertainty Index, use “T8”. The output xts data object contains data for 143 countries, so it might be better to plot only the data you need.

wtui_data <- get_WUI("T8")
dygraph(wtui_data$CHN)

Financial Stree Indicator (FSI) data

Data is available at monthly and quarterly frequencies. get_fsi() outputs monthly data by default.

fsi_mon <- get_FSI()
dygraph(fsi_mon)
fsi_quar <- get_FSI(freq = "quarterly")
dygraph(fsi_quar)

Geopolitical Risk Index (GPR) data

There are 4 types: 1. type= 1 for quarterly GRI, 2. type = 2 for GPRH, 3. type = 3 for GPR of countries, 4. type = 4 for GPR words.

gpr <- get_GPR(type = 1)
dygraph(gpr$GPR)

Conclusion

Data from the EPU website have different sources, with different data formats and frequencies. epuR takes cares of the nuisances by providing a consistent way of collecting different index data.