* * Empirical example from section 2.3, pp 49-52 * /* PCURVE contains 3 data series. The frequency is annual and the range is 1948 to 1989. The basic series are: CPI Consumer price index UNR Unemployment rate for civilian workers, aged 16 and over These series are taken from various issues of the Economic Report of the President. The derived series is: INF = 100*{CPI - CPI(-1)}/CPI(-1) = Inflation rate A specially chosen subset of data for the years 1957 to 1970 is used in Chapter 2 to illustrate the fitting of a nonlinear relation between inflation and the unemployment rate. This relation does not survive exposure to the full data set. */ cal(a) 1948 open data pcurve.asc data(format=prn,org=columns) 1948:1 1989:1 cpi inf unr table * * Figure 2.6, p. 50 * set unr_1 = unr{1} set unr_2 = 1/unr_1 * spgraph(hfields=2,vfields=2,header="Unemployment vs Inflation",subheader="1957-1970") scatter(vlabel="Inflation",hlabel="Unemployment") 1 # unr inf 1957:1 1970:1 scatter(vlabel="Inflation",hlabel="Reciprocal Unemployment, Lagged") 1 # unr_2 inf 1957:1 1970:1 scatter(vlabel="Inflation",hlabel="Unemployment, Lagged") 1 # unr_1 inf 1957:1 1970:1 spgraph(done) * * Regressions for Table 2.2, p. 51 * linreg inf 1957:1 1970:1 # constant unr * linreg inf 1957:1 1970:1 # constant unr_1 * linreg inf 1957:1 1970:1 # constant unr_2 * * We're going to save the coefficients for a graph later * compute b=%beta * * Equation, p. 52, estimated by non-linear least squares * nonlin alpha1 alpha2 alpha3 frml inflation_f inf = alpha1 + (alpha3/(unr{1}-alpha2)) compute alpha1=alpha2=alpha3=0 nlls(frml=inflation_f,iters=50) inf 1957:1 1970:1 * * We're now going to generate the functions for the regression on the reciprocal * and the non-linear function, and graph them together with the actual data. To * graph the functions, we generate an "x" series ranging from (actually 3.1) to * 13 which represents the values of the lagged unemployment, and projected * values for each of the functions based upon those. * set unrtest 1 100 = 3+.1*t set prj1 1 100 = b(1)+b(2)/unrtest set prj2 1 100 = alpha1+(alpha3/(unrtest-alpha2)) * * SCATTER uses dots for the the actual data and lines for the two fitted series. * The ovsame option is used to force both sets to use the same scale. * scatter(style=dots,overlay=lines,ovcount=2,ovsame) 3 # unr_1 inf 1957:1 1970:1 # unrtest prj1 # unrtest prj2