* * Example 19.2 from pages 568-569 * open data tablef5-1[1].txt calendar(q) 1950 data(format=prn,org=columns) 1950:1 2000:4 year qtr realgdp realcons realinvs realgovt realdpi $ cpi_u m1 tbilrate unemp pop infl realint * * Create inflation as 400*the difference of the logs of the CPI. Multiplying by * 400 converts to percentages on an annual basis. (100 for decimal to percent, 4 * for quarterly to annual). * set infl = 400.0*(log(cpi_u)-log(cpi_u{1})) set delinfl = infl-infl{1} * * Regress the difference in inflation on unemployment * linreg delinfl / resids # constant unemp * * RATS allows recursively defined FRML's as is required here. We define two * FRML's - the first computes the expected inflation given a test setting of * lambda, the other is the actual regression equation, which uses the generated * value for expected inflation. * * To make the recursive generation of expected inflation work out, the EXPINFL * formula uses the series PHAT to hold the forecasts. PHAT is initialized to * current inflation, but that is used only for the first period. Subsequent * periods will be generated by the update formula. * set phat = infl nonlin lambda b0 b1 compute lambda=0,b0=%beta(1),b1=%beta(2) frml expinfl = (phat=lambda*phat{1}+(1-lambda)*infl{1}) frml phillips infl = expinfl+b0+b1*unemp nlls(frml=phillips) infl 1950:3 * * * Estimate the NAIRU * summarize(title="Estimate of the NAIRU") -%beta(2)/%beta(3) disp "Confidence Interval" %sumlc+%invnormal(.025)*sqrt(%varlc) "to" %sumlc+%invnormal(.975)*sqrt(%varlc) * * This generates the graph in Figure 19.2, using a grid spaced .01 apart from 0 * to 1. We first create a function which gives the sum of squared residuals given * lambda. * function test lambda clear resids set phat 1950:3 1950:3 = infl{1} set phat 1950:4 * = lambda*phat{1}+(1-lambda)*infl{1} set resids 1950:3 * = infl-phat-b0-b1*unemp compute test=%normsqr(resids) end * * We then create a grid for the test values for lambda, and a series with the * corresponding values for the sum of squared residuals. * set grid 1 101 = (t-1)*.01 set ygrid 1 101 = test(grid) scatter(style=lines,footer="Figure 19.2 Sums of Squares for Phillips Curve Estimates",hlabel="Lambda",vlabel="S(L)") # grid ygrid