overview_efna.Rmd
The Economic Freedom of North America (EFNA) data from Stansel et al. is a subnational analog to the Economic Freedom of the World (EFW) reports that measures the degree to which subnational entities in the United States, Canada, and Mexico support the principles of economic freedom and free exchange. The index itself is comprised of 10 variables across three general areas listed below.
Area | Description |
---|---|
Area 1 | Government Spending |
Area 2 | Taxes |
Area 3 | Labor Market Freedom |
Currently, the FreedomData
package only includes data for the U.S. states. I may expand this in the future to include Canada and Mexico.
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
PackageFirst we load the package.
# load data
library(FreedomData)
I will begin with the EFNA panel dataset.
data("efna")
The EFNA
dataset covers the 50 continental U.S. states with the exclusion of the District of Columbia and the U.S. territories. The indexes themselves are produced on an annual basis from 1981-present.
First, let’s see what’s included in the EFNA
data by showing the top 10 most free states in the latest year.
# view EFNA header
efna %>%
arrange(-year, -efna_index) %>%
filter(row_number() <= 10) %>%
modify_at(5:8, ~round(.x, 2)) %>%
# subset and rename
select(`USPS` = usps,
`State Name` = state_name,
`EFNA Index` = efna_index,
`Area 1: Spending` = efna_spending,
`Area 2: Taxation` = efna_taxation,
`Area 3: Labor Markets` = efna_lab_mkt,
) %>%
knitr::kable(.)
USPS | State Name | EFNA Index | Area 1: Spending | Area 2: Taxation | Area 3: Labor Markets |
---|---|---|---|---|---|
NH | New Hampshire | 7.84 | 8.80 | 7.00 | 7.70 |
FL | Florida | 7.73 | 8.59 | 7.31 | 7.28 |
VA | Virginia | 7.62 | 8.31 | 6.44 | 8.11 |
TX | Texas | 7.61 | 8.37 | 6.70 | 7.77 |
TN | Tennessee | 7.55 | 7.30 | 7.90 | 7.46 |
SD | South Dakota | 7.28 | 8.18 | 6.99 | 6.68 |
GA | Georgia | 7.27 | 7.82 | 6.48 | 7.52 |
IN | Indiana | 7.08 | 7.51 | 6.76 | 6.98 |
OK | Oklahoma | 7.05 | 7.60 | 6.85 | 6.70 |
ID | Idaho | 7.04 | 8.09 | 6.04 | 6.99 |
Let’s see how the top 5 states in 2019 evolved over time.
# top and bottom
efna %>%
arrange(-year, -efna_index) %>%
filter(year == max(year),
row_number() <= 3 | row_number() >= 48) %>%
pull(usps) -> top_states
p <- efna %>%
filter(usps %in% top_states) %>%
mutate(efna_index = round(efna_index, 2)) %>%
# subset and rename cols
select(`EFNA Index` = efna_index,
`State Name` = state_name,
`Year` = year) %>%
# now produce plot
ggplot(data = .,
aes(x = `Year`,
y = `EFNA Index`,
color = `State Name`)) +
geom_line() +
theme_minimal() +
scale_color_manual(values = my_colors("cb")[1:6],
guide = "none")+
labs(title = "Economic Freedom by State, 1981-2018",
caption = "Source: Stansel et al. (2020)",
x = "",
y = "Avg. Economic Freedom Score")
# render plot
plotly::ggplotly(p)
Dean Stansel, José Torra, and Fred McMahon (2020). Economic Freedom of North America 2020. Fraser Institute. https://www.fraserinstitute.org/studies/economic-freedom-of-north-america-2020