• R/O
  • SSH

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

File Info

Rev. b47bddfa2f577c0ed9d7fdb12a5f28def74aa332
크기 6,763 bytes
Time 2023-01-09 23:59:36
Author Lorenzo Isella
Log Message

I now have a lollipop diagram.

Content

---
title: "Temporary Framework: an Overview"
output: 
  bookdown::word_document2:
  fig_caption: yes
fontsize: 12pt
number_sections: false
---





```{r setup, include=FALSE} 
knitr::opts_chunk$set(warning = FALSE, message = FALSE) 
rm(list=ls())
options( scipen = 16 )


library(tidyverse, warn.conflicts = FALSE)
library(janitor)
library(viridis)
library(scales)
## library(treemap)
library(stringi)
library(flextable)
library(Cairo)
library(lubridate)
library(RJSDMX)
## library(eumaps)


source("/home/lorenzo/myprojects-hg/R-codes/stat_lib.R")


df1 <- readRDS("../../intermediate_files/decisions_budget_time.RDS") 

n_dec_time <- df1 |>
    group_by(date) |>
    summarise(n_dec=sum(n_decisions),
              budget_tot=sum(budget)) |>
    ungroup() |>
    arrange(date) |>
    mutate(cumul=cumsum(n_dec),
           cumul_budget=cumsum(budget_tot)/1e3)


df2 <- readRDS("../../intermediate_files/decisions_budget_time_cont.RDS") 

n_dec_time2 <- df2 |>
    rename("date"="decision_date") |> 
    group_by(date) |>
    summarise(n_dec=sum(n_decisions),
              budget_tot=sum(budget)) |>
    ungroup() |>
    arrange(date) |>
    mutate(cumul=cumsum(n_dec),
           cumul_budget=cumsum(budget_tot)/1e3) |>
    mutate(cumul_perc=cumul/max(cumul),
           cumul_budget_perc=cumul_budget/(max(cumul_budget)))



query <- "nama_10_gdp/A.CP_MEUR.B1GQ."

gdp <- estat_retrieval(query) |> 
    clean_data() |> 
    mutate(time_period=as.numeric(time_period)) |> 
    select(time_period, obs_value,geo ) |>
    filter(time_period==2019)




df3 <- readRDS("../../intermediate_files/rep1_cleaned.RDS") 


exp_ms <- df3 |>
    group_by(member_state_2_letter_code) |>
    summarise(budget_ms=sum(confirmed_budgets)) |>
    ungroup() |>
    left_join(y=iso_map_eu27, by=c("member_state_2_letter_code"="iso2")) |>
    mutate(percentage=budget_ms/sum(budget_ms)) |>
    mutate(perc_format=format_col_preserve_sum(percentage*100,1)) |>
    mutate(perc_format=paste(perc_format,"%", sep="")) |>
    arrange(budget_ms)  |>
    mutate(country=fct_inorder(country)) |>
    left_join(y=gdp, by=c("member_state_2_letter_code"="geo")) |>
    mutate(perc_gdp=budget_ms/obs_value)




```





<!-- --- -->
<!-- title: "Temporary Framework: an Overview" -->
<!-- --- -->



# Budget and Measures at the European Level
The Temporary Framework (TF) represented a coordinated European effort
to face the disruption in the economy due to the outbreak of the Covid
19 epidemics.

Figure \@ref(fig:fig-number) illustrates the time evolution of the
total number of approved decisions, which increase approximately
linearly between March 2020 and April 2022. By the end of February 2022, about
90% of the total number of decisions (1264 out of 1408) had been approved.


```{r fig-number,fig.cap="Cumulative number of approved TF measures.",echo=FALSE,fig.height = 6, fig.width = 12}
ggplot(data = n_dec_time2,
              aes(x = date, y = cumul)) +
    ## geom_point(size=2 , shape=1
    ##       , stroke=2
    ##         ) +
    ## geom_line(size=2)+
    ## geom_col()+
    ## geom_line(linewidth=1.)+
    geom_point(size=1.5)+

    my_ggplot_theme2("right")+
    ## facet_wrap(~ member_state_2_letter_code, nrow=7, scales = "free_y" )+

    ## coord_cartesian(ylim = c(0, 1)) +

    scale_y_continuous(breaks=seq(0, 1500, by=500)) +
    ## coord_cartesian(ylim = c(0, 1500)) +
    scale_x_date(breaks = "2 month",
                 date_labels = "%b\n%Y",
                 expand=c(0.,0)## ,
                 ## guide = guide_axis(n.dodge = 2)
                 )+
    coord_cartesian(ylim = c(0, 1500),
                    xlim = c(ymd("2020-01-01") , ymd("2022-12-31"))) +
    ylab("Cumulative Number of\nApproved Decisions")+
    xlab(NULL)
```


When we consider the cumulative approved budget, shown in Figure
\@ref(fig:fig-budget), a very different picture emerges.
By the end July 2020 the aid appoved already
amounted to almost 90% of the total (2687 billion out of 3044
billion), but the number of approved decisions were about 20% of the
total (297 decisions out of 1408).

In other words, we conclude that most of the budget had been allocated
by July 2020 and the ensuing decisions, although numerous, had a much
smaller impact on the TF budget.


```{r fig-budget,fig.cap="Cumulative approved TF budget in billion of euro.",echo=FALSE,fig.height = 6, fig.width = 12}
ggplot(data = n_dec_time2,
              aes(x = date, y = cumul_budget)) +
    ## geom_point(size=2 , shape=1
    ##       , stroke=2
    ##         ) +
    ## geom_line(size=2)+
    ## geom_col()+
    ## geom_line(linewidth=1.)+
    geom_point(size=1.5)+

   my_ggplot_theme2("right")+
    ## facet_wrap(~ member_state_2_letter_code, nrow=7, scales = "free_y" )+


    scale_y_continuous(## breaks=seq(0, 1500, by=500)
                       ) +
    ## coord_cartesian(ylim = c(0, 1500)) +
    scale_x_date(breaks = "2 month",
                 date_labels = "%b\n%Y",
                 expand=c(0,0)## ,
                 ## guide = guide_axis(n.dodge = 2)
                 )+
    ## expand_limits(x = as.Date(c( "2023-01-01")))+
    coord_cartesian(xlim = c(ymd("2020-01-01") , ymd("2022-12-31"))) +

    ylab("Cumulative Approuved\nBudget (bil \u20ac)")+
    xlab(NULL)
```


The overall EU27 TF budget, broken down by the contribution of each
Member State (MS) is illustrated in Figure \@ref(fig:fig-budget-ms),
where we see the prominent role played by the German budget, which is
by itself more than 50% of the total EU27 TF budget.

```{r fig-budget-ms,fig.cap='Approved TF budget per MS in billion euro. On top of each national budget we report the percentage of the total EU27 budget it amounts to.',echo=FALSE,fig.height = 8, fig.width = 12}
   
 exp_ms |> 
    ggplot(aes(x = budget_ms/1e3, y = country, label = perc_format ## , fill=type
               )) +
     ## geom_col()+

    geom_segment(aes(x = 0, y = country, xend = budget_ms/1e3, yend = country),
                 linewidth=2, color="darkgrey") +
    ## geom_point() +
    coord_cartesian(xlim = c(0, 1700)) +

    geom_point(size = 7) +
        ## geom_text(color = 'white', size = 2)+
     geom_text(## color="white",
               size = 4,
               vjust=0.5, hjust=-0.6,
               fontface="bold"
               )+
     my_ggplot_theme2("right")+
    ## theme(legend.position="top")+
    xlab("Approved Budget (bil \u20ac)")+
    ylab(NULL)+
    labs(title = NULL)
```


The combined budget of the top six countries in Figure
\@ref(fig:fig-budget-ms) (Germany, Italy, France, Spain, Poland and Belgium) amounts to about 90% of the total EU27 TF budget.

When we consider the allocation of the TF budget as a fraction of the
pre-TF GDP (i.e. the GDP of the MS in 2019) a different picture
emerges.