library(readr)
library(tidyverse)
library(mFilter)
library(xtable)
library(plotly)
library(reshape2)
dta.vacancy <- read_csv("/Users/bastienpatras/Dropbox/My Mac (bastien’s MacBook Pro)/Downloads/LAB_REG_VAC_02042021231444336.csv")
dta.unemploy <- read_csv("/Users/bastienpatras/Dropbox/My Mac (bastien’s MacBook Pro)/Downloads/STLABOUR_02042021220639459.csv",
col_types = cols(FREQUENCY = col_character(),
TIME = col_character()))
dta.master <- dta.vacancy %>%
select(Time, Country, Subject, Value) %>%
filter(Subject == "Job vacancies, Total, Unfilled vacancies (stock), sa" |
Subject == "Registered unemployment, Level, Total, sa") %>%
pivot_wider(names_from = Subject, values_from = Value) %>%
rename(Job_vacancy = `Job vacancies, Total, Unfilled vacancies (stock), sa`,
Unemployment = `Registered unemployment, Level, Total, sa`) %>%
separate(col = Time, into= c("Quarter", "Year"), sep = "-") %>%
mutate(Quarter = case_when(Quarter == 'Q1' ~ 'Feb',
Quarter == 'Q2' ~ 'May',
Quarter == 'Q3' ~ 'Aug',
Quarter == 'Q4' ~ 'Nov')) %>%
unite("Time", Quarter:Year ,sep = "-") %>%
select(Time, Country, Job_vacancy, Unemployment) %>%
na.omit()
head(dta.master)
## # A tibble: 6 x 4
## Time Country Job_vacancy Unemployment
## <chr> <chr> <dbl> <dbl>
## 1 Feb-2000 Austria 34919. 204437.
## 2 May-2000 Austria 35469. 195722.
## 3 Aug-2000 Austria 35877. 191444.
## 4 Nov-2000 Austria 35716. 185652.
## 5 Feb-2001 Austria 33386. 189360.
## 6 May-2001 Austria 30863. 198013.
plot.1.dta <- dta.master %>%
separate(col = Time, into= c("Quarter", "Year"), sep = "-")
plot.1 <- plot.1.dta %>%
ggplot(aes(x=Job_vacancy, y=Unemployment, group=Year, color=Year)) +
geom_line() +
geom_point() +
theme(axis.text = element_text(angle = 90),
panel.background = element_rect(fill = "white"),
axis.line = element_line(size = 1, colour = "gray", linetype=2)) +
scale_color_manual(values = c("#FCEEF5", "#F9DCEB",
"#F6CBE1", "#F3BAD7",
"#FE9ABD", "#FEAECA",
"#F0A8CE", "#ED96C5",
"#EA85BB", "#E773B1",
"#E462A8", "#E1519E",
"#DE3F94", "#DC2E8A",
"#D12380", "#C02176",
"#AE1E6B", "#9D1B60",
"#8C1855", "#7A154B",
"#691240", "#570F35")) +
facet_wrap(~Country)
ggplotly(plot.1)
# Reshape in long format
dta.master.long <- melt(dta.master, id=c('Country', 'Time'))
# Extract summary stat
dta.master.long.stat <- dta.master.long %>%
dplyr::group_by(variable, Country) %>%
summarise(min = min(value),
max = max(value),
mean = mean(value),
sd = sd(value),
q25 = quantile(value, probs = 0.25),
median = median(value),
q75 = quantile(value, probs = 0.75))
# Regression at each point in time
dta.master.stat <- dta.master %>%
group_by(Country) %>%
summarise(cov = cov(log(Job_vacancy), log(Unemployment)),
var_Unemployment = var(log(Unemployment)),
Coeff = cov/var_Unemployment,
gamma = 1/(1-Coeff))
# xtable(dta.master.long.stat)
# xtable(dta.master.stat)
From this equation we can retrieve \(m\) taking as a proxy to new hires \(M = L_t-L_{t-1}\) :
\[m = \frac{M}{u^\gamma v^{1-\gamma}} \]
# Loading the employed data from OECD
dta.employ <- read_csv("/Users/bastienpatras/Dropbox/My Mac (bastien’s MacBook Pro)/Downloads/STLABOUR_03042021104533477.csv")
# Data prep 1
dta.employ <- dta.employ %>%
select(Time, Country, Subject, Value) %>%
filter(Subject == "Employed population, Aged 15 and over, All persons") %>%
pivot_wider(names_from = Subject, values_from = Value) %>%
rename(Employed = `Employed population, Aged 15 and over, All persons`) %>%
separate(col = Time, into= c("Quarter", "Year"), sep = "-") %>%
mutate(Quarter = case_when(Quarter == 'Q1' ~ 'Feb',
Quarter == 'Q2' ~ 'May',
Quarter == 'Q3' ~ 'Aug',
Quarter == 'Q4' ~ 'Nov')) %>%
unite("Time", Quarter:Year ,sep = "-") %>%
select(Time, Country, Employed) %>%
na.omit()
dta.employ <- dta.employ %>%
group_by(Country) %>%
mutate(Employed.growth = Employed-dplyr::lag(Employed)) %>%
na.omit()
# Data prep 2 : Adding gammas for computation
dta.master.new <- left_join(dta.master, dta.employ, by=c('Time', 'Country')) %>%
na.omit()
dta.master.stat.new <- dta.master.stat %>% select(Country, gamma)
# Output : data to compute matching efficiency
dta.master.new <- left_join(dta.master.new, dta.master.stat.new, by=c('Country')) %>%
na.omit()
# Compute matching efficiency by country :
matching.efficiency <- dta.master.new %>%
group_by(Country) %>%
summarise(Time = Time,
Matching.efficiency = Employed.growth/((Unemployment)^gamma*(Job_vacancy)^(1-gamma)))
# Plotting matching efficiency by country
plot.2.dta <- matching.efficiency %>%
group_by(Country) %>%
mutate(id = row_number()) %>%
filter(Country != "Spain" &
Country != "Luxembourg" &
Country != "Austria" &
Country != "Belgium" &
Country != "Portugal" ) %>%
mutate(HP.Trend = mFilter::hpfilter(Matching.efficiency, type = "lambda", freq = 6.25)$trend)
plot.2.dta.long <- melt(plot.2.dta, id=c("Country", "id", "Time"))
plot.2 <- plot.2.dta.long %>%
ggplot(aes(x=id, y=value, group=variable, color=variable)) +
geom_line() +
geom_point(size=0.1) +
theme(axis.text = element_text(angle = 90)) +
xlab(label = "Quarterly frequency : 20 years period from 2000 to 2020") +
ylab(label = "HP filter & Matching efficiency estimations")+
scale_color_manual(values = c("#FE9ABD", "#E773B1"))+
facet_wrap(~Country)
ggplotly(plot.2)
# Plot bevedridge
plot.1.dta <- dta.master %>%
separate(col = Time, into= c("Quarter", "Year"), sep = "-") %>%
filter(Country == "United Kingdom")
plot.2.dta <- dta.master %>%
separate(col = Time, into= c("Quarter", "Year"), sep = "-") %>%
filter(Country == "Germany")
plot.3.dta <- dta.master %>%
separate(col = Time, into= c("Quarter", "Year"), sep = "-") %>%
filter(Country == "Norway")
plot.4.dta <- dta.master %>%
separate(col = Time, into= c("Quarter", "Year"), sep = "-") %>%
filter(Country == "Sweden")
plot.1 <- plot.1.dta %>%
ggplot(aes(x=Unemployment, y=Job_vacancy, group=Year, color=Year)) +
geom_line() +
geom_point() +
xlab("Unemployment (thousand of people)") +
ylab("Job vacancy (thousand of people)") +
theme(axis.text = element_text(angle = 90),
panel.background = element_rect(fill = "white"),
axis.line = element_line(size = 0.25, colour = "black")) +
scale_color_manual(values = c("#FCEEF5", "#F9DCEB",
"#F6CBE1", "#F3BAD7",
"#FE9ABD", "#FEAECA",
"#F0A8CE", "#ED96C5",
"#EA85BB", "#E773B1",
"#E462A8", "#E1519E",
"#DE3F94", "#DC2E8A",
"#D12380", "#C02176",
"#AE1E6B", "#9D1B60",
"#8C1855", "#7A154B",
"#691240", "#570F35"))
show(plot.1)
plot.2 <- plot.2.dta %>%
ggplot(aes(x=Unemployment, y=Job_vacancy, group=Year, color=Year)) +
geom_line() +
geom_point() +
xlab("Unemployment (thousand of people)") +
ylab("Job vacancy (thousand of people)") +
theme(axis.text = element_text(angle = 90),
panel.background = element_rect(fill = "white"),
axis.line = element_line(size = 0.25, colour = "black")) +
scale_color_manual(values = c("#FCEEF5", "#F9DCEB",
"#F6CBE1", "#F3BAD7",
"#FE9ABD", "#FEAECA",
"#F0A8CE", "#ED96C5",
"#EA85BB", "#E773B1",
"#E462A8", "#E1519E",
"#DE3F94", "#DC2E8A",
"#D12380", "#C02176",
"#AE1E6B", "#9D1B60",
"#8C1855", "#7A154B",
"#691240", "#570F35"))
show(plot.2)
plot.3 <- plot.3.dta %>%
ggplot(aes(x=Unemployment, y=Job_vacancy, group=Year, color=Year)) +
geom_line() +
geom_point() +
xlab("Unemployment (thousand of people)") +
ylab("Job vacancy (thousand of people)") +
theme(axis.text = element_text(angle = 90),
panel.background = element_rect(fill = "white"),
axis.line = element_line(size = 0.25, colour = "black")) +
scale_color_manual(values = c("#FCEEF5", "#F9DCEB",
"#F6CBE1", "#F3BAD7",
"#FE9ABD", "#FEAECA",
"#F0A8CE", "#ED96C5",
"#EA85BB", "#E773B1",
"#E462A8", "#E1519E",
"#DE3F94", "#DC2E8A",
"#D12380", "#C02176",
"#AE1E6B", "#9D1B60",
"#8C1855", "#7A154B",
"#691240", "#570F35"))
show(plot.3)
plot.4 <- plot.4.dta %>%
ggplot(aes(x=Unemployment, y=Job_vacancy, group=Year, color=Year)) +
geom_line() +
geom_point() +
xlab("Unemployment (thousand of people)") +
ylab("Job vacancy (thousand of people)") +
theme(axis.text = element_text(angle = 90),
panel.background = element_rect(fill = "white"),
axis.line = element_line(size = 0.25, colour = "black")) +
scale_color_manual(values = c("#FCEEF5", "#F9DCEB",
"#F6CBE1", "#F3BAD7",
"#FE9ABD", "#FEAECA",
"#F0A8CE", "#ED96C5",
"#EA85BB", "#E773B1",
"#E462A8", "#E1519E",
"#DE3F94", "#DC2E8A",
"#D12380", "#C02176",
"#AE1E6B", "#9D1B60",
"#8C1855", "#7A154B",
"#691240", "#570F35"))
show(plot.4)