Home | GLMs | Multilevel | Survival | Demography | Stata | R
Home Lecture Notes Stata Logs Datasets Problem Sets

Solutions to Problem Set 2
Inflation and Central Bank Independence

We start by reading the data as instructed

. use http://data.princeton.edu/wws509/datasets/inflation
(Inflation and central bank independence)

[1] The Inflation Rate

(a) Plot the inflation rate versus the questionnaire-based measure of central bank independence, using different symbols for developed and developing countries. Make sure you identify the point on the lower left as Ethiopia. (In part d you will add to this plot; turn in only the final result.)

Here's the final plot:

. rename ques  cbi     // I prefer the name cbi to ques

. gen ET = cbi < 1.5   // Ethiopia has the lowest cbi!

. twoway (scatter inf cbi if dev, msymbol(square)) ///
>    (scatter inf cbi if !dev, msymbol(triangle)) ///
>    (scatter inf cbi if ET, msymbol(none) mlabel(country)) ///
>    (lfit inf cbi if dev) (lfit inf cbi if !dev & !ET) ///
>  , legend(ring(0) pos(1) order(1 "Developed" 2 "Not Developed")) ///
>    title("Inflation and Central Bank Independence in 22 Countries")

. graph export ps2fig1.png, width(400) replace
(file ps2fig1.png written in PNG format)

We see that inflation increases with lack of central bank independence in developing countries and is comparatively flat in develop countries. Ethiopia is unsual in having the lowest measure of central bank independence and practically no inflation.

For simplicity, exclude Ethiopia from the analyses in parts 1.b, 1.c and 1.d

(b) Regress the inflation rate on the indicator variable for developed countries and interpret the coefficients. Test the significance of the coefficient of developed countries.

. reg inf dev  if !ET

      Source |       SS       df       MS              Number of obs =      21
-------------+------------------------------           F(  1,    19) =   14.68
       Model |  7230.98225     1  7230.98225           Prob > F      =  0.0011
    Residual |  9360.82727    19   492.67512           R-squared     =  0.4358
-------------+------------------------------           Adj R-squared =  0.4061
       Total |  16591.8095    20  829.590476           Root MSE      =  22.196

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -37.15455   9.698255    -3.83   0.001    -57.45323   -16.85586
       _cons |       44.7   7.019082     6.37   0.000     30.00889    59.39111
------------------------------------------------------------------------------

We see that the inflation rate in developed countries is 37.2 percentage points lower than in developing countries. The difference is clearly significant with a t-test of -3.83 on 19 d.f.(equivalent to an F-test of 14.68 on 1 and 19 d.f.). [Obviously including Ethiopia would reduce this difference.]

(c) Add the measure of central bank independence to the model and comment on the results. What happens to the difference between developed and developing countries once you adjust for central bank independence?

. reg inf dev cbi if !ET

      Source |       SS       df       MS              Number of obs =      21
-------------+------------------------------           F(  2,    18) =   15.07
       Model |  10387.9256     2  5193.96282           Prob > F      =  0.0001
    Residual |  6203.88388    18  344.660215           R-squared     =  0.6261
-------------+------------------------------           Adj R-squared =  0.5845
       Total |  16591.8095    20  829.590476           Root MSE      =  18.565

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -21.60823   9.601308    -2.25   0.037    -41.77983   -1.436628
         cbi |  -7.634352   2.522519    -3.03   0.007    -12.93397   -2.334737
       _cons |   82.10833   13.68371     6.00   0.000     53.35991    110.8567
------------------------------------------------------------------------------

The results indicate that the inflation rate in developed countries is 21.6 percentage points lower than in developing countries with the same level of central bank independence. This difference is still significant after adjusting, but it has been reduced in magnitude indicating that part of the differences between developed and developing countries can be attributed to differences in central bank independence. [Including Ethiopia would reduce the adjusted difference and in fact render it non-significant.]

(d) Test whether the slope of inflation by central bank independence is the same in developed and developing countries by adding an interaction effect. Superimpose the fitted lines from this model on the plot of part a.

. gen devXcbi = dev*(cbi-6)

. reg inf dev cbi devXcbi if !ET

      Source |       SS       df       MS              Number of obs =      21
-------------+------------------------------           F(  3,    17) =   13.73
       Model |  11743.5947     3  3914.53157           Prob > F      =  0.0001
    Residual |  4848.21483    17  285.189107           R-squared     =  0.7078
-------------+------------------------------           Adj R-squared =  0.6562
       Total |  16591.8095    20  829.590476           Root MSE      =  16.888

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -24.25895   8.817976    -2.75   0.014    -42.86325   -5.654646
         cbi |  -11.19989   2.817723    -3.97   0.001    -17.14476   -5.255012
     devXcbi |   10.58504   4.854921     2.18   0.044     .3420529    20.82803
       _cons |   99.57945   14.80364     6.73   0.000      68.3465    130.8124
------------------------------------------------------------------------------

The first thing to note is that the interaction term is significant at the conventional 5% level, so we reject the hypothesis that the slopes are the same. In developing countries the slope is -11.2, indicating that inflation is lower in countries where the central bank has more independence, at the rate of 11.2 percentage points less inflation per point in the central bank independence measure. In developed countries the slope is -0.6 (calculated as -11.2 + 10.6), suggesting that differences by central bank independence are much smaller than in developing countries. In fact, we have no evidence that the line for developed countries is not flat (test not shown). Because I centered cbi on 6, a value very close to the median, when computing the interaction, the coefficient of dev tells us that the inflation rate is 24.2 percentage points lower in developed than developing countries at the median level of central bank independence. The lines requested were included in the graph shown above.

(e) Comment briefly on how the conclusions of the analysis in part 2.d would be altered if we included Ethiopia.

Obviously including Ethiopia would pull the line would developing countries down at the the low independence end, making it less step. This would reduce the estimated difference in slopes, in fact making it non significant:

. reg inf dev cbi devXcbi

      Source |       SS       df       MS              Number of obs =      22
-------------+------------------------------           F(  3,    18) =    4.93
       Model |  7680.60602     3  2560.20201           Prob > F      =  0.0113
    Residual |  9341.75762    18  518.986534           R-squared     =  0.4512
-------------+------------------------------           Adj R-squared =  0.3597
       Total |  17022.3636    21  810.588745           Root MSE      =  22.781

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -24.82716   11.89387    -2.09   0.051    -49.81526    .1609369
         cbi |  -5.641294   3.298455    -1.71   0.104    -12.57109    1.288503
     devXcbi |   5.026446   6.270925     0.80   0.433    -8.148279    18.20117
       _cons |    66.7961   16.57334     4.03   0.001     31.97681    101.6154
------------------------------------------------------------------------------

Consider this a cautionary tale of how much the results can change if we include an observation that obviously does not follow the same model as the others.

[2] Working with Log(Inflation)

(a) Plot the log of the inflation rate versus the measure of central bank independence. (In part d you will add to this plot. Turn in only the final result.)

Here's my plot, with a addition of two other countries that proved useful in part 3.

. gen CR = country == "Costa Rica"

. gen DE = country == "Germany"

. gen pos = 3

. replace pos = 9 if DE
(1 real change made)

. gen linf = log(inf)
(1 missing value generated)

. twoway (scatter linf cbi if dev, msymbol(circle)) ///
>    (scatter linf cbi if !dev, msymbol(triangle)) ///
>    (scatter linf cbi if ET | CR | DE, msymbol(none) mlabel(country) mlabv(pos)) ///
>    (lfit linf cbi if dev) (lfit linf cbi if !dev & !ET) ///
>  , legend(ring(0) pos(1) order(1 "Developed" 2 "Not Developed")) ///
>    title("Log-Inflation and Central Bank Independence in 22 Countries")

. graph export ps2fig2.png, width(400) replace
(file ps2fig2.png written in PNG format)

Working with the log of the inflation rate confirms the impressions we had earlier but shows more clearly what's going on at the low inflation end, where differences by central bank independence become clearer.

For simplicity, exclude Ethiopia from the analyses in parts 2.b, 2.c and 2.d

(b) Regress the log of the inflation rate on the indicator variable for developed countries and interpret the coefficient of developed countries. (Be careful if your interpretation relies on a common approximation; you should make sure it is reasonable in this case.)

. reg linf dev if !ET

      Source |       SS       df       MS              Number of obs =      21
-------------+------------------------------           F(  1,    19) =   23.07
       Model |  12.2253436     1  12.2253436           Prob > F      =  0.0001
    Residual |  10.0705669    19  .530029838           R-squared     =  0.5483
-------------+------------------------------           Adj R-squared =  0.5245
       Total |  22.2959105    20  1.11479553           Root MSE      =  .72803

------------------------------------------------------------------------------
        linf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |   -1.52772   .3180998    -4.80   0.000    -2.193511   -.8619296
       _cons |   3.474515   .2302238    15.09   0.000     2.992652    3.956379
------------------------------------------------------------------------------

. di exp(_b[dev])-1
-.78297013

The coefficient of -1.53 tells us that the inflation rate is 78.3% lower in developed than in developing countries. (This is not a small coefficient, so e^b-1 is not ~ b, a conclusion that the inflation rate is 153% lower would be absurd.)

(c) Add the measure of central bank independence to the model and interpret the coefficients.

. reg linf dev cbi if !ET

      Source |       SS       df       MS              Number of obs =      21
-------------+------------------------------           F(  2,    18) =   19.45
       Model |  15.2435574     2  7.62177868           Prob > F      =  0.0000
    Residual |  7.05235315    18  .391797397           R-squared     =  0.6837
-------------+------------------------------           Adj R-squared =  0.6485
       Total |  22.2959105    20  1.11479553           Root MSE      =  .62594

------------------------------------------------------------------------------
        linf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -1.047026   .3237171    -3.23   0.005     -1.72713   -.3669215
         cbi |  -.2360553   .0850491    -2.78   0.012    -.4147368   -.0573739
       _cons |   4.631187   .4613592    10.04   0.000     3.661907    5.600466
------------------------------------------------------------------------------

. di exp(_b[dev])-1
-.64901992

. di exp(_b[cbi])-1
-.21026301

The inflation rate in developed countries is 64.9% lower than in developing countries with the same level of central bank independence. Each additional point in the central bank independence scale is associated with a 21% reduction in the inflation rate. (The coefficient of -0.236 is almost small enough in magnitude to be interpreted directly as a percent reduction.)

(d) Test for an interaction between central bank independence and the indicator of development. Superimpose the fitted lines from this model on the plot of part 2.a. Do we have evidence that these lines are not parallel?

. reg linf dev cbi devXcbi if !ET

      Source |       SS       df       MS              Number of obs =      21
-------------+------------------------------           F(  3,    17) =   13.27
       Model |  15.6246221     3  5.20820736           Prob > F      =  0.0001
    Residual |  6.67128842    17  .392428731           R-squared     =  0.7008
-------------+------------------------------           Adj R-squared =  0.6480
       Total |  22.2959105    20  1.11479553           Root MSE      =  .62644

------------------------------------------------------------------------------
        linf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -1.091467   .3271017    -3.34   0.004    -1.781591   -.4013428
         cbi |  -.2958341   .1045231    -2.83   0.012    -.5163586   -.0753097
     devXcbi |    .177466   .1800927     0.99   0.338    -.2024964    .5574283
       _cons |   4.924103   .5491393     8.97   0.000      3.76552    6.082685
------------------------------------------------------------------------------

. di exp(_b[dev])-1
-.6642764

. di exp(_b[cbi])-1
-.2560892

. di exp(_b[devXcbi])-1
.1941874

Interestingly the interaction in this model is not significant; in other words we have no evidence that differences in the inflation rate between developed and developing countries are relatively larger at lower levels of central bank independence. By the same token the relative effect of central bank independence appears to be the same in developed and developed countries.

This example illustrate sthe fact that interactions are always specific to a given scale. Two variables that interact when we look at absolute differences in inflation no longer interaction when we look at relative differences, resulting in a simpler model.

(e) Comment briefly on how including Ethiopia would alter your conclusions in part 2.d.

It looks form the plot that including or excluding Ethiopia would still make a difference, but perhaps a smaller one than when we work in the log scale

. reg linf dev cbi devXcbi

      Source |       SS       df       MS              Number of obs =      22
-------------+------------------------------           F(  3,    18) =    4.63
       Model |  10.4017126     3  3.46723755           Prob > F      =  0.0143
    Residual |  13.4777026    18  .748761257           R-squared     =  0.4356
-------------+------------------------------           Adj R-squared =  0.3415
       Total |  23.8794153    21  1.13711501           Root MSE      =  .86531

------------------------------------------------------------------------------
        linf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -1.113581   .4517695    -2.46   0.024    -2.062714    -.164449
         cbi |  -.0794977   .1252865    -0.63   0.534    -.3427148    .1837194
     devXcbi |  -.0388705    .238191    -0.16   0.872    -.5392911    .4615501
       _cons |   3.648198   .6295114     5.80   0.000     2.325644    4.970753
------------------------------------------------------------------------------

. di exp(_b[dev])-1
-.67161923

. di exp(_b[cbi])-1
-.07641984

. di exp(_b[devXcbi])-1
-.03812474

The results show that this is indeed the case, the line for developing countries is less step than before, but the difference between develop and developing countries at the median level of central bacnk independence is still significant, whereas it just failed the 5% level when we worked with the inflation rate.

[3] Regression Diagnostics

Calculate the following diagnostics for the additive model of part 2.c including Ethiopia, so we can see what the different measures would say about this country.

(a) Compute leverages and comment briefly on the four countries with the most leverage. Why do you think Costa Rica comes at the top of the list?

. reg linf dev cbi

      Source |       SS       df       MS              Number of obs =      22
-------------+------------------------------           F(  2,    19) =    7.31
       Model |  10.3817723     2  5.19088614           Prob > F      =  0.0044
    Residual |   13.497643    19  .710402263           R-squared     =  0.4348
-------------+------------------------------           Adj R-squared =  0.3753
       Total |  23.8794153    21  1.13711501           Root MSE      =  .84285

------------------------------------------------------------------------------
        linf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         dev |  -1.124559   .4351395    -2.58   0.018    -2.035317    -.213802
         cbi |  -.0902519   .1037896    -0.87   0.395     -.307486    .1269822
       _cons |   3.697374   .5383573     6.87   0.000      2.57058    4.824169
------------------------------------------------------------------------------

. predict plinf
(option xb assumed; fitted values)

. gen pinf = exp(plinf)

. predict lev, lev

. gsort -lev // sort in descending order

. list country dev cbi inf pinf lev in 1/5

     +----------------------------------------------------+
     |    country   dev   cbi   inf       pinf        lev |
     |----------------------------------------------------|
  1. | Costa Rica     0   8.1    23    19.4206   .2795697 |
  2. |   Ethiopia     0   1.3     4   35.87523   .2533228 |
  3. |    Germany     1    10     3   5.313742   .2332329 |
  4. | Yugoslavia     0   1.7    73    34.6032   .2160479 |
  5. |    Bahamas     0   7.1     6   21.25487   .1877608 |
     +----------------------------------------------------+

Interestingly enough Costa Rica turned out to have more leverage than Ethiopia. Recall that leverage is a function of just the predictors. Ethiopia has some leverage because it has a very low cbi score, but so do two other developing countries. Costa Rica is unusual in having a very high cbi score among developing countries, with no other developing country coming close.

(b) Calculate the jack-knifed residuals and list any countries with values in excess of 2. Do we have evidence of any outliers, after making allowance for the fact that we are making multiple tests?

. predict rstu, rstu
(1 missing value generated)

. gen absrstu = abs(rstu)
(1 missing value generated)

. gsort -absrstu

. list country dev cbi inf pinf rstu in 1/5

     +---------------------------------------------------+
     |  country   dev   cbi   inf       pinf        rstu |
     |---------------------------------------------------|
  1. | Ethiopia     0   1.3     4   35.87523    -4.05593 |
  2. |  Bahamas     0   7.1     6   21.25487   -1.753668 |
  3. | Barbados     0   5.4     7   24.77944   -1.652541 |
  4. |     Peru     0   2.2   108   33.07641    1.610441 |
  5. |   Uganda     0   5.3    72   25.00409    1.350238 |
     +---------------------------------------------------+

The only residual exceeding 2 in absolute value is Ethiopia. With 22 countries the Bonferroni critical value is

. di invttail(18, 0.025/22)
3.5530015

because the residual for Ethiopia exceeds 3.55 in absolute value we can conclude with 95% confidence that this country is an outlier; in other words, it does not follow the same model as the rest.

(c) Compute the Cook distances. Any indication of an influential observation? Why is Ethiopia at the low end of the scale of central bank independence a lot more influential than Germany at the high end?

. predict cook, cook
(1 missing value generated)

. gsort -cook

. list country dev cbi inf pinf lev rstu cook if _n < 5 | DE

     +-------------------------------------------------------------------------+
     |  country   dev   cbi   inf       pinf        lev        rstu       cook |
     |-------------------------------------------------------------------------|
  1. | Ethiopia     0   1.3     4   35.87523   .2533228    -4.05593   1.026026 |
  2. |  Bahamas     0   7.1     6   21.25487   .1877608   -1.753668   .2136355 |
  3. |     Peru     0   2.2   108   33.07641   .1762778    1.610441   .1706901 |
  4. | Barbados     0   5.4     7   24.77944   .1012868   -1.652541   .0940266 |
  7. |  Germany     1    10     3   5.313742   .2332329   -.7661245   .0608344 |
     +-------------------------------------------------------------------------+

The only country to exceed the cutoff of one, indicating that it had substantial incluence in the results, is Ethiopia, so we have done well to exclude it.

The reason Ethiopia has such large influence is that it combines high leverage with a large residual; in other words it had potential influence and had an unexpected outcome. In contrast, Germany had almost equal leverage but the residual was modest, so its inflation rate behaved like that of other countries.

[4] Box-Cox Transformations

(a) Did we need to transform the data? Was the natural logarithm a good transformation? Explore these two questions in a Box-Cox framework by formally testing for the log and identity transformations using an additive model excluding Ethiopia.

This is easy to do with the box-cox commnand. Note that we specify the variable in the original scale

. boxcox inf dev cbi if !ET, model(lhs)
Fitting comparison model

Iteration 0:   log likelihood =   -99.8552  
Iteration 1:   log likelihood = -86.423172  
Iteration 2:   log likelihood = -85.698169  
Iteration 3:   log likelihood = -85.697791  
Iteration 4:   log likelihood = -85.697791  

Fitting full model

Iteration 0:   log likelihood = -89.525997  
Iteration 1:   log likelihood = -78.135069  
Iteration 2:   log likelihood = -74.404917  
Iteration 3:   log likelihood = -74.139808  
Iteration 4:   log likelihood = -74.139759  
Iteration 5:   log likelihood = -74.139759  

                                                  Number of obs   =         21
                                                  LR chi2(2)      =      23.12
Log likelihood = -74.139759                       Prob > chi2     =      0.000

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      /theta |  -.1758896   .2086666    -0.84   0.399    -.5848686    .2330895
------------------------------------------------------------------------------

Estimates of scale-variant parameters
----------------------------
             |      Coef.
-------------+--------------
Notrans      |
         dev |  -.6350744
         cbi |  -.1396188
       _cons |   3.242201
-------------+--------------
      /sigma |   .3558902
----------------------------

---------------------------------------------------------
   Test         Restricted     LR statistic      P-value
    H0:       log likelihood       chi2       Prob > chi2
---------------------------------------------------------
theta = -1      -80.932391        13.59           0.000
theta =  0      -74.500419         0.72           0.396
theta =  1      -89.525997        30.77           0.000
---------------------------------------------------------

The table at the bottom of the output tells us that we reject the hypothesis that the transformation parameter is 1 (indicating no need to transform), with a chi-squared of 31 on 1 df. The log transformation, corresponding to a transformation parameter of 0, cannot be rejected, with a chi-squared of 0.72 on one df, and in fact is very close to the optimum transformation of -0.18 (which would be a pain to interpret).

(b) Plot the Box-Cox profile log-likelihood as a function of the transformation parameter. The Stata logs section of the website shows how to do this in a simple loop. log close

. scalar  maxlogL = e(ll)  // save max of logL

. gen logL = .
(23 missing values generated)

. gen theta = .
(23 missing values generated)

. local i = 1

. forvalues theta = -1(.1)1 {
  2.     quietly {
  3.                 boxcox inf dev cbi if !ET, model(lhs) from(`theta',copy) iterate(0)
  4.                 replace theta = `theta' in `i'
  5.                 replace logL = e(ll) in `i'
  6.                 local i = `i' + 1
  7.         }
  8. }               

. gen cb = maxlogL - 3.84/2 if abs(theta) < .75
(8 missing values generated)

. graph twoway (line logL theta) (line cb theta), ///
>     title("Box-Cox Profile Log-Likelihood") ///
>         xtitle(theta) ytitle(log-likelihood) legend(off)

. graph export ps2fig3.png, width(400) replace    
(file ps2fig3.png written in PNG format)

We see that any transformation between -.5 and .2 would be acceptable, that the log transformation is close to the optimum, and that leaving the data untransformed is soundly rejected.

end of do-file

. usl2html using solset2, header(head), footer(foot)
invalid 'footer' 
r(198);

. usl2html using solset2, header(head)  footer(foot)