Introduction to Data Analysis

8.3. Practice

Instructions: this week’s exercise is called 8_imf.R. Download or copy-paste that file into a new R script, then open it and run it with the working directory set as the IDA folder. If you download the script, make sure that your browser preserved its .R file extension.

This week's exercise is based on an article published by Chris Giles in the Financial Times. In “Robustness of IMF data scrutinised” (October 12, 2012), Giles raises an issue with recent IMF data on the relationship between fiscal consolidation (i.e. austerity politics) and growth forecasts. The graphs below express the gist of the problem:

FT graphs, by Chris Giles auto "http://www.ft.com/intl/cms/s/0/85a0c6c2-1476-11e2-8cf2-00144feabdc0.html"

The main theme here is the size of the (Keynesian) fiscal multipliers applied by governments in reaction to the current economic crisis. Giles further documented the issue in a blog post, “Has the IMF proved multipliers are really large? (wonkish)”, in which he explains being puzzled by the following graph, taken from the last IMF World Economic Outlook report (p. 43):

WEO plot, from the IMF report "http://www.imf.org/external/pubs/ft/weo/2012/02/pdf/text.pdf"

In a later post, “The IMF and multipliers, again” (January 7, 2013), Giles explains that the controversy over that graph led to additional analysis that put the original diagnostic of the World Economic Outlook report into question. Let's run our own analysis, which uses the IMF data provided by Giles and draws on the replication code by Chris Hanretty.

Step 1: Preparation

Start by reading all references cited above, then create the imf dataset by downloading the 8_imf.R script: install any missing packages and run the first segment of the code (alternately, just download the imf.weo.2012.csv dataset). The segment ends with a scatterplot called imf.plot that replicates the base structure of the IMF graph:

plot of chunk imf-plot-auto

The simple linear equation that is being run here is of the form \(Y = \alpha + \beta X + \epsilon\), where \(Y = \delta_{\text{growth forecast error}}\), \(X = \delta_{\text{structural balance}}\) and \(\beta\) is the estimated average size of the fiscal multiplier. Chris Giles' argument is that the estimation of \(\beta\) by the IMF is not robust to the inclusion of additional data and/or to the exclusion of outliers.

Step 2: Replication

Turn now to the simple linear regression component of the script and execute the model. The results will be stored into the imf.lm object. The regression coefficient for the \(\delta_{\text{structural balance}}\) should be, as reported by Chris Giles, somewhere near -0.68. Take some time to analyze that result substantively, using the sources mentioned above.


Call:
lm(formula = D_growth ~ D_struct_bal, data = imf)

Residuals:
   Min     1Q Median     3Q    Max 
-5.506 -0.899 -0.342  1.063  6.101 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)  
(Intercept)     0.175      0.480    0.37    0.719  
D_struct_bal   -0.676      0.267   -2.53    0.019 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.32 on 22 degrees of freedom
Multiple R-squared:  0.226, Adjusted R-squared:  0.191 
F-statistic: 6.42 on 1 and 22 DF,  p-value: 0.0189

The script offers a few more graphs at that stage, including one that overlays a simple regression line and a 95% confidence interval to the raw data. The plot below also shows the residuals of the regression model, and at that stage, you should be able to intuitively detect which countries are going to be outliers:

plot of chunk ols-plot-auto

Step 3: Diagnostics

The debate between Chris Giles and the IMF revolves in large part around the presence of outliers in the data. We will instead focus on the results of the simple linear regression model and diagnose which countries are outliers to the overall trend from there. Run the third component of the script until you reach that residuals-versus-fitted-values plot:

plot of chunk rvf-plot-auto

Finally, take a closer look at some outliers. The IMF uses Cook's distance to detect them, so we have included Cook's \(D\) in the script, and as Chris Giles notes, New Zealand, which was originally excluded from the IMF analysis, is among the outliers. Sweden will also show up if you use standardized residuals instead of Cook's \(D\):

plot of chunk outliers-plot-auto

Coursework

Form a group with one or two other classmates, and run again through the code in order to replicate the plots and model results together. The script concludes by looking at the normality of the outliers: to finish the exercise, write the code to run the original model without them, in order to get your own battery of results and make up your mind about the original IMF analysis

To report on your work, write a one-page report on your analysis, in which you explain what you have learnt from reading the initial IMF results, what you coded to complement that analysis, and what you can finally conclude about whether the IMF was correct in its estimation of the average size of the fiscal multiplier.

Next week: Visualization in time: Time series.