Convergence clubs in labor productivity and its proximate sources
Set up
library(tidyverse)
library(ExPanDaR)
library(haven)
library(ggridges)
library(ggrepel)
library(ConvergenceClubs)
library(hdrcde)
library(isoband)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
✔ ggplot2 3.3.4 ✔ purrr 0.3.4
✔ tibble 3.1.2 ✔ dplyr 1.0.7
✔ tidyr 1.1.3 ✔ stringr 1.4.0
✔ readr 1.4.0 ✔ forcats 0.5.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
This is hdrcde 3.4
Data: Import, select, transform
df_long <- read_stata("https://github.com/quarcs-lab/mendez2020-convergence-clubs-code-data/raw/master/assets/dat.dta")
df_long %>% head()
sample <- df_long %>%
filter(hi1990 == "yes") %>%
#filter(hi1990 == "no") %>%
#filter(region == "Africa") %>%
#filter(region == "Asia") %>%
#filter(region == "Americas") %>%
#filter(region == "Europe") %>%
select(country, year, log_lp) %>%
#select(country, year, log_ky) %>%
#select(country, year, log_h) %>%
#select(country, year, log_tfp) %>%
as.data.frame()
sample %>% head()
sample <- sample %>%
rename(Y = names(.)[3])
df_wide <- sample %>%
pivot_wider(names_from = year, values_from = Y) %>%
as.data.frame()
head(df_wide)
h <- computeH(df_wide[,-1], quantity = "h")
df_h <- data.frame(h)
country_names <- df_wide %>%
select(country)
h_wide <- cbind(country_names, df_h)
head(h_wide)
h_long <- pivot_longer(h_wide,
starts_with("X"),
names_to = "year",
names_prefix = "X",
values_to = "h")
h_long %>% head()
Transition paths
h_long %>%
ggplot(aes(x = as.numeric(year), y = h, color = country)) +
geom_line()
Convergence test: Log-t
H <- computeH(df_wide[,-1], quantity = "H")
round(estimateMod(H, time_trim=1/3, HACmethod = "FQSB"),2)
Convergence clubs
clubs <- findClubs(df_wide,
dataCols=2:ncol(df_wide),
unit_names = 1,
refCol=ncol(df_wide),
time_trim =0.3,
cstar=0,
HACmethod = 'FQSB')
summary(clubs)
Number of convergence clubs: 4
Number of divergent units: 1
| # of units | beta | std.err | tvalue | cstar
-------- ------------- ---------- ---------- ---------- --------
club1 | 5 | 0.206 | 0.09 | 2.287 | 0
club2 | 15 | 0.17 | 0.076 | 2.245 | 0
club3 | 3 | 0.111 | 0.047 | 2.349 | 0
club4 | 2 | 4.589 | 1.867 | 2.459 | 0
plot(clubs)
plot(clubs, clubs=NULL, avgTP = TRUE, legend=TRUE)
Merge test
mclubs_PS <- mergeClubs(clubs, mergeMethod='PS', mergeDivergent=FALSE)
summary(mclubs_PS)
Number of convergence clubs: 3
Number of divergent units: 1
| merged clubs | # of units | beta | std.err | tvalue
-------- --------------- ------------- ---------- ---------- ----------
club1 | clubs: 1 | 5 | 0.206 | 0.09 | 2.287
club2 | clubs: 2, 3 | 18 | -0.058 | 0.056 | -1.047
club3 | clubs: 4 | 2 | 4.589 | 1.867 | 2.459
plot(mclubs_PS)
plot(mclubs_PS, clubs=NULL, avgTP = TRUE, legend=TRUE)
mclubs_PS