Sunday, June 7, 2015

European debt and interest

I was told the Eurostat package would be interesting for me.  This is indeed true and now I want to use it to plot some data which are related core of some of the European policies; debt.
In these plots I only show individual countries, not aggregated over the EU or Euro zone. In addition Norway is dropped, because it had less data, is not an EU country and has fairly different financial positions than the rest of Europe. This resulted in 28 countries, which can be displayed in a grid of 4 by 7.

Lending and borrowing

In lending and borrowing we see the crisis troubles. Especially in Ireland there is a spike showing increased borrowing. In a few years from net lender to 30% borrowing is massive. But the same can be seen in Spain, UK. In fact it only few countries did not have more borrowing in that period.
The plot has an additional line, in red 3% borrowing is depicted, 3% being in the stability and growth pact. It can be seen that quite some countries are under or near those 3% or edging closer to it.

Debt

The consequence of all that borrowing is debt. All countries have debt. The red line is placed at 60%, which is the upper limit for the Euro zone stability and growth pact. Many countries had debt under 60% before the crisis, examples, Spain, Netherlands and Ireland. Italy and Belgium were quite above those 60% and got some increase. Germany, Europe's economic miracle, had debts over 60%. There seems to be no obvious link between the debt before crisis and the debt post crisis.

Interest

The consequence of debt is interest. This is probably the most remarkable set of data. There are no targets here. What is visible is the decrease in interest for many countries at the end of last century. Here the positive influence of the Euro is visible. But the strange thing is that many countries did hardly suffer increased interest payments during the crisis at all. Italy payed approximately 5% for more than 10 years now. Netherlands has a decreasing curve which was flattened by the crisis and is decreasing again. In summary, many countries currently pay historically low interests.
Part of this is obviously the work of various policies to contain the crisis. But it can also mean that debt may not be the biggest problem Europe faces at this moment.

Code

The code is fairly simple. What is needed is retrieving what codes mean. For countries these are extracted from the database. For the other codes it is most easy just to open the table on the Eurostat website and look there which codes are interesting.
The dplyr package allowed channeling selection and plotting in one call, thereby eliminating the chance of not updating intermediate data frames.
library(eurostat)
library(dplyr)
library(ggplot2)
library(scales)

r1 <- get_eurostat('gov_10dd_edpt1')

# add country names
r2 <- get_eurostat_dic('geo') %>%
    mutate(.,
        geo=V1,
        country=V2,
        country=gsub('\\(.*$','',country)) %>%
    select(.,geo,country) %>%
    merge(.,r1) %>%
# filter countries
    filter(.,
        !grepl('EA.*',geo),
        !grepl('EU.*',geo),
        geo!='NO')

filter(r2,
        sector=='S13', # general government
        na_item=='B9', # Net lending (+) /net borrowing (-)
        unit=='PC_GDP' # % GDP
    ) %>%
    ggplot(.,aes(x=time,y=values)) + 
    geom_line()+
    ylab('% GDP')+
    facet_wrap(~country,nrow=4) +
    ggtitle('Net lending (+) /net borrowing (-)') +
    xlab('Year') +
    geom_hline(yintercept=-3,colour='red') +
    scale_x_date(
        breaks=c(as.Date("2000-01-01"),as.Date("2010-01-01") )
        ,labels = date_format("%Y"))

#########
filter(r2,
        sector=='S13', # general government
        na_item=='GD', # Gross debt
        unit=='PC_GDP' # % GDP
    ) %>%
    ggplot(.,aes(x=time,y=values)) + 
    geom_line()+
    ylab('% GDP')+
    facet_wrap(~country,nrow=4) +
    ggtitle('Gross Debt') +
    xlab('Year') +
    geom_hline(yintercept=60,colour='red') +
    scale_x_date(
        breaks=c(as.Date("2000-01-01"),as.Date("2010-01-01") )
        ,labels = date_format("%Y"))

#########
filter(r2,
        sector=='S13', # general government
        na_item=='D41PAY', # Interest, payable
        unit=='PC_GDP' # % GDP
    ) %>%
    ggplot(.,aes(x=time,y=values)) +
    geom_line()+
    ylab('% GDP')+
    facet_wrap(~country,nrow=4) +
    ggtitle('Interest, payable') +
    xlab('Year') +
    scale_x_date(
        breaks=c(as.Date("2000-01-01"),as.Date("2010-01-01") )
        ,labels = date_format("%Y"))

1 comment: