R Codes from my post about the Reinhart-Rogoff working paper

[latexpage]In this post, I explain how to make two graphs from my post dealing with the article of Reinhart and Rogoff (french). The first figure is simple plot while the other is non parametric estimate by Splines.

First of all, you need the (obviously free) software R, once you’ve launched R, you need to install the ggplot2 package. Just run that code in the command window to install the package:

library(ggplot2)setwd(‘C:/Users/Gauthier/Desktop/figures_RR/’)

This package is an easy and very nice plotting system. Download the data R&R I extracted from the OECD Database, I slightly reworked the dataset to load it easily in R. Edit this following command and set your own path to the folder where you have extracted your data,setwd(‘C:/Users/Gauthier/Desktop/figures_RR/’)

Then we have to load the data via R. In the dataset, we have 3 time series of country members of the Euro Area: the public nominal debt, nominal GDP and the GDP deflator. To read them, you have to execute in the command windows,

Figure 2

To draw the second figure that plots the correlation between the debt to GDP ratio with the GDP growth, we need to calculate the real GDP growth. We simply need to evaluate,
\begin{equation}\label{eq:MaxUtility}
\Delta GDP^{real}_{t}=\left(\frac{GDP^{real}_{t+1}}{GDP^{real}_{t}}-1\right)100
\end{equation}
We create the variable grgdp and we perform the calculation via another simple loop,