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)