data1 <- revalorisation_pension %>%
select(date, index) %>%
gather(variable, value, -date) %>%
group_by(variable) %>%
complete(date = seq.Date(min(date), max(date), by = "day")) %>%
fill(value) %>%
filter(date >= as.Date("2012-01-01")) %>%
ungroup %>%
left_join(cpi2_m, by = "date") %>%
filter(day(date) == 1) %>%
filter(date >= as.Date("2012-01-01")) %>%
transmute(date,
`IPCH, Eurostat` = (value/value[1])*(cpih[1]/cpih),
`IPC, INSEE` = (value/value[1])*(cpi[1]/cpi)) %>%
gather(type, OBS_VALUE, -date) %>%
mutate(variable = "Retraites vs. 2012")
load_data("insee/INDICE-TRAITEMENT-FP-net-brut-mensuel.RData")
data2 <- indicefp %>%
select(date, point_indice_en_euros) %>%
arrange(desc(date)) %>%
gather(variable, value, -date) %>%
group_by(variable) %>%
complete(date = seq.Date(min(date), max(date), by = "day")) %>%
fill(value) %>%
ungroup %>%
left_join(cpi2_m, by = "date") %>%
filter(day(date) == 1) %>%
left_join(net_brut_mensuel, by = "date") %>%
filter(date >= as.Date("2012-01-01")) %>%
transmute(date,
`IPCH, Eurostat` = (value/value[1])*(cpih[1]/cpih)*(net_brut/net_brut[1]),
`IPC, INSEE` = (value/value[1])*(cpi[1]/cpi)*(net_brut/net_brut[1])) %>%
gather(type, OBS_VALUE, -date) %>%
mutate(variable = "Point d'Indice de la Fonction Publique vs. 2012")
data2 %>%
bind_rows(data1) %>%
mutate(variable = factor(variable, levels = c("Retraites vs. 2012",
"Point d'Indice de la Fonction Publique vs. 2012"))) %>%
ggplot() + geom_line(aes(x = date, y = OBS_VALUE, color = variable, linetype = type)) + theme_minimal() +
scale_linetype_manual(values = c("dashed", "solid")) +
scale_x_date(breaks = c(seq(1999, 2100, 1), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
theme(legend.position = c(0.32, 0.25),
legend.title = element_blank(),
legend.key.size = unit(0.5, "cm")) +
scale_y_log10(breaks = seq(2, 0.02, -0.02),
labels = percent(seq(2, 0.02, -0.02)-1, acc = 1)) +
ylab("Valeur vs. 2012") + xlab("") +
geom_text(data = . %>% filter(date == max(date)),
aes(x = date, y = OBS_VALUE, label = percent(OBS_VALUE-1, acc = 0.1), color = variable),
fontface ="bold", size = 3)