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)
GEPU_current
GEPU_ppp
Australia
Brazil
Canada
Chile
China
Colombia
France
Germany
Greece
India
Ireland
Italy
Japan
Korea
Mexico
Netherlands
Russia
Spain
Singapore
Sweden
UK
US
SCMP.China
Mainland.China
0
200
400
600
800
1000
1200
2000

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

dygraph(all_data)

GEPU_current
GEPU_ppp
Australia
Brazil
Canada
Chile
China
Colombia
France
Germany
Greece
India
Ireland
Italy
Japan
Korea
Mexico
Netherlands
Russia
Spain
Singapore
Sweden
UK
US
SCMP.China
Mainland.China
0
200
400
600
800
1000
1200
2000
If you need EPU for a specific region, use region = argument:

china_epu <- get_EPU(region = "China")
dygraph(china_epu)
0
200
400
600
800
2000
2010
2020

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

china_data <- all_data$China
dygraph(china_data)

0
200
400
600
800
2000
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))
0
200
400
600
800
2000
2010
2020

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)

0
200
400
600
800
1000
1200
1400
1990
2000
2010
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)

0
200
400
600
800
1000
1200
1400
2000
2010
2020
Japan TPU is also available, to get Japan TPU:

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

EPU
FPU
MPU
TPU
ERPU
0
100
200
300
400
500
600
700
1990
2000
2010
2020
The japan TPU data also contains EPU, FPU, MPUI, and ERPU. If you need TPU, simply:

dygraph(jap_tpu$TPU)
0
100
200
300
400
500
600
700
1990
2000
2010
2020

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)
10
20
30
40
50
60
70
2000

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)
0
100
200
300
400
2000

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)
0
5
10
15
20
25
30
2000
2010

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)
98
100
102
104
106
1900
2000
fsi_quar <- get_FSI(freq = "quarterly")
dygraph(fsi_quar)
98
100
102
104
1900
2000

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)
0
100
200
300
400
500
2000

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.