overview_efw.Rmd
The Economic Freedom of the World (EFW) report provides researches with a widely accepted and cited measure of economic institutions, measured for various countries over a long time frame. The EconFreedom
package provides an easy way of accessing these data in R and will be updated with each successive update of the EFW report. The EFW reports are used extensively in the economics, political science, and political economy literature as a primary measure of economic institutional quality, i.e. institutions that promote and protect individual liberty, property rights, and freedom of exchange. A simple Google Scholar search of the keywords economic freedom of the world
yields a total of 3.6 million results (searched 10.16.2021).
The following description comes directly from the Gwartney et al. (2021) EFW report that describes the data.
The index published in Economic Freedom of the World measures the degree to which the policies and institutions of countries are supportive of economic freedom. The cornerstones of economic freedom are personal choice, voluntary exchange, freedom to enter markets and compete, and security of the person and privately owned property. Forty-two data points are used to construct a summary index, along with a Gender Legal Rights Adjustment to measure the extent to which women have the same level of economic freedom as men. The degree of economic freedom is measured in five broad areas. — Gwartney et al. (2021)
The EFW measures economic institutions along 5 primary dimensions, or area. The areas are listed as follows.
Area | Description |
---|---|
Area 1 | Size of Government |
Area 2 | Legal System and Property Rights |
Area 3 | Sound Money |
Area 4 | Freedom to Trade Internationally |
Area 5 | Regulation |
Gender Legal Rights Adjustment |
While the EFW incorporates over 40 different individual measures to calculate the above areas, the EconFreedom
package currently only provides the main 5 summary indexes and the composite EFW score. I may include the additional measures in a future release of this package; however, I seldom see any on the subindicators used in the empirical literature that leverages the EFW dataset.
FreedomData
PackageIn this article I highlight the usage of this simple data package and elucidate some key caveats with the EFW dataset. My baseline assumption is that the end user will make use of the common tidyverse
set of tools to examine and analyze these data. To highlight some features of the data of the data I will also use plotly
to make interactive charts.
# load packages to use
if (!require("pacman")) install.packages("pacman")
#> Loading required package: pacman
pacman::p_load(tidyverse,
plotly,
DT)
FreedomData
PackageI will begin with the EFW panel dataset.
data("efwpnl")
First, let’s see what the first few rows of the data look like and what variables we have available using head()
to show the first 10 rows. In the first few columns we have the main country ID variables, including the ISO Alpha-3 code, the country name, the data year, and its geographic and income groupings according to the World Bank Group. I added in the World Bank’s 3-digit region code and income group to facilitate further merging of these data and analyses. These identifiers are sourced directly from the World Bank here. The remaining columns are the composite and individual area economic freedom scores.
# header of the EFW data
efwpnl %>%
arrange(-year, iso_code) %>%
head(., n = 10) %>%
knitr::kable(., digits = 2)
iso_code | country_name | year | region_code | region_name | income_group | efw_index | size_of_govt | legal_system | sound_money | trade_freedom | regulation |
---|---|---|---|---|---|---|---|---|---|---|---|
AGO | Angola | 2019 | SSF | Sub-Saharan Africa | Lower middle income | 5.50 | 7.53 | 3.67 | 4.93 | 5.39 | 5.97 |
ALB | Albania | 2019 | ECS | Europe & Central Asia | Upper middle income | 7.81 | 8.00 | 5.26 | 9.86 | 8.23 | 7.70 |
ARE | United Arab Emirates | 2019 | MEA | Middle East & North Africa | High income | 7.28 | 5.41 | 5.94 | 9.06 | 8.48 | 7.51 |
ARG | Argentina | 2019 | LCN | Latin America & Caribbean | Upper middle income | 5.50 | 6.26 | 4.80 | 4.00 | 6.42 | 5.99 |
ARM | Armenia | 2019 | ECS | Europe & Central Asia | Upper middle income | 8.03 | 7.83 | 6.30 | 9.65 | 8.53 | 7.82 |
AUS | Australia | 2019 | EAS | East Asia & Pacific | High income | 8.20 | 6.54 | 8.30 | 9.67 | 7.95 | 8.52 |
AUT | Austria | 2019 | ECS | Europe & Central Asia | High income | 7.86 | 5.43 | 8.33 | 9.42 | 8.45 | 7.65 |
AZE | Azerbaijan | 2019 | ECS | Europe & Central Asia | Upper middle income | 6.44 | 5.38 | 5.24 | 7.00 | 7.24 | 7.37 |
BDI | Burundi | 2019 | SSF | Sub-Saharan Africa | Low income | 5.65 | 6.35 | 4.10 | 8.68 | 2.70 | 6.41 |
BEL | Belgium | 2019 | ECS | Europe & Central Asia | High income | 7.62 | 4.75 | 7.45 | 9.41 | 8.39 | 8.12 |
Here I will show the basic usage of the EFW data and a brief analysis. Here I will use the tidyverse
and plotly
packages to parse and analyze the data.
# EFW by region
p <- efwpnl %>%
filter(year == 2019) %>%
group_by(region_name) %>%
summarize(efw_index = round(mean(efw_index, na.rm = T),2)) %>%
# subset and rename cols
select(`Region Name` = region_name,
`EFW Index` = efw_index) %>%
# now produce the plot
ggplot(data = .,
aes(x = `Region Name`,
y = `EFW Index`))+
geom_col(stat = "identity",
width = .75,
aes(fill = `Region Name`)) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust=1),
legend.position = "none") +
scale_fill_manual(values = my_colors("cb")[1:7],
guide = FALSE)+
labs(title = "Economic Freedom by Region (2019)",
caption = "Source: Gwartney et al. (2021)",
x = "",
y = "Avg. Economic Freedom Score")
#> Warning: Ignoring unknown parameters: stat
ggplotly(p, tooltip = c("x","y"))
Clearly we can see that the North American countries have the highest average EFW scores with East Asia and Europe coming in second and third, respectively. Next, let’s look at the pattern for high income v. low income countries.
# EFW by income group
p <- efwpnl %>%
filter(year == 2019, !is.na(income_group)) %>%
group_by(income_group) %>%
summarize(efw_index = round(mean(efw_index, na.rm = T), 2)) %>%
# subset and rename cols
select(`Income Group` = income_group,
`EFW Index` = efw_index) %>%
# now produce the plot
ggplot(data = .,
aes(x = `Income Group`,
y = `EFW Index`))+
geom_col(stat = "identity",
width = .75,
aes(fill = `Income Group`)) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust=1),
legend.position = "none") +
scale_fill_manual(values = my_colors("cb")[1:7],
guide = FALSE)+
labs(title = "Economic Freedom by World Bank Income Group (2019)",
caption = "Source: Gwartney et al. (2021)",
x = "",
y = "Avg. Economic Freedom Score")
#> Warning: Ignoring unknown parameters: stat
# render plot
ggplotly(p, tooltip = c("x","y"))
Having worked with the EFW dataset for the past few years, I want to highlight in this section a few features of the EFW dataset that researchers should pay attention to. While I will add to this list over time, the main issue I want to highlight is the country coverage in the EFW report in the historical data.
While the EFW reports have a long history and, therefore, a long time-series for each country, the coverage back in time can be spotty depending on where you are in the world. It’s important to examine your data and check which countries you actually have data for. To see this, let’s look at the Middle East and North Africa (MENA).
# EFW coverage in MENA
p <- efwpnl %>%
filter(region_name == "Middle East & North Africa") %>%
mutate(efw_present = !is.na(efw_index),
year = factor(year)) %>%
# subset and rename cols
select(`Country Name` = country_name,
`Data Year` = year,
`EFW Present` = efw_present) %>%
# now produce the plot
ggplot(data = .,
aes(x = `Data Year`,
y = `Country Name`))+
geom_raster(aes(fill = `EFW Present`)) +
scale_fill_manual(values = c("#999999", "#E69F00"),
name = "Data Present",
labels = c("Missing", "Present")) +
theme_minimal() +
labs(title = "EFW Coverage by Country (MENA)",
x = "Years Present",
y = "Country")+
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
axis.text.y = element_text(angle = 30, vjust = 0.5, hjust=1))
# render plot
ggplotly(p)
While we have 20 countries in the region, only 8 countries have complete data going back to 1970. Furthermore, 4 countries are missing EFW scores up until 2009 and 3 countries (Libya, Iraq, and Djibouti) are missing data later than 2009.
Fortunately, countries with more available data over time are unsurprisingly higher-income countries. For example, data coverage in the member countries of the Organisation for Economic Co-operation and Development (OECD) is mostly complete. Some notable exceptions are former countries from the Soviet Union, whose data series begin in 1995 (or earlier for Poland and Estonia).
# EFW coverage in the OECD
oecd <- c("AUS","AUT","BEL","CAN","CHL","CZE","DNK","EST","FIN","FRA","DEU",
"GRC","HUN","ISL","IRL","ISR","ITA","JPN","KOR","LUX","MEX","NLD",
"NZL","NOR","POL","PRT","SVK","SVN","ESP","SWE","CHE","TUR","GBR",
"USA")
p <- efwpnl %>%
filter(iso_code %in% oecd) %>%
mutate(efw_present = !is.na(efw_index),
year = factor(year)) %>%
# subset and rename cols
select(`Country Name` = country_name,
`Year` = year,
`EFW Present` = efw_present) %>%
# now produce the plot
ggplot(data = .,
aes(x = `Year`,
y = `Country Name`))+
geom_raster(aes(fill = `EFW Present`)) +
scale_fill_manual(values = c("#999999", "#E69F00"),
name = "Data Present",
labels = c("Missing", "Present")) +
theme_minimal() +
labs(title = "EFW Coverage by Country (OECD)",
x = "Years Present",
y = "Country")+
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
axis.text.y = element_text(angle = 30, vjust = 0.5, hjust=1))
# render plot
ggplotly(p)
James Gwartney, Robert Lawson, Joshua Hall, and Ryan Murphy (2021). Economic Freedom Dataset, published in Economic Freedom of the World: 2021 Annual Report. Fraser Institute. www.fraserinstitute.org/economic-freedom/dataset