/* -------------------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------------------- */ /* This program file contains RATS programs for "Unemployment Insurance Claims and Economic Activity" by William T. Gavin and Kevin L. Kliesen in the May/June 2002 issue of the Federal Reserve Bank of St. Louis Review. Data used by the programs is found in the accompanying data file. */ /* -------------------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------------------- */ ******************************************************************************************** ******************************************************************************************** * Table2.prg * This program generated table 2 ******************************************************************************************** ******************************************************************************************** cal 1955 1 4 all 0 2002:3 *------------------------------------------------------------------------ * Data input and transformation *----------------------------------------------------------------------------- open data tab2.rat data(format=rats) / $ LR1 LANAGRA1 LIPRIVA1 LICM1 LIUM1 $ LR2 LANAGRA2 LIPRIVA2 LICM2 LIUM2 $ LR3 LANAGRA3 LIPRIVA3 LICM3 LIUM3 $ GDPQ close data * Note that lium is the growth rate of the number of insured unemployed * lr is the unemployment rate *note that we have loaded 16 series *See "quart vars.xls" to see how series 1-15 are constructed *GDPQ is GDP quantity index set dy / = log(GDPQ/GDPQ(t-1))*400 *------------------------------------------------------------------------------ * Estimate forecasting models *------------------------------------------------------------------------------ ******************************************************************* /* This program estimates out of sample forecasts using current quarter monthly labor market information. */ ******************************************************************** decl vector[series] forcasts(16) dofor x = 1 to 15 do i = 1,87 smpl 1967:1 1979:2+i linreg(noprint) dy / # constant x dy{1 to 4} prj x+17 1979:3+i 1979:3+i end do i end do x dofor x = 1 to 15 smpl 1967:1 2001:2 linreg dy / # constant x dy{1 to 4} prj x+17 2001:3 2001:3 end do x ********************************** * AR Forecasts ********************************* do i = 1,87 smpl 1967:1 1979:2+i linreg(noprint) dy / # constant dy{1 to 4} prj 33 1979:3+i 1979:3+i end do i smpl 1967:1 2001:2 linreg dy / # constant dy{1 to 4} prj 33 2001:3 2001:3 smpl 1979:4 2001:3 decl vector[series] sqerrors(16) cperrors(15) *************************************************** * creates series of squared errors numbered 34 to 49 *************************************************** dofor x = 18 to 33 set [series]x+16 = (dy-[series]x)**2 end do x *************************************************** * creates series of error cross products numbered 50 to 64 *************************************************** dofor x = 18 to 32 set [series]x+32 = (dy-[series]x)*(dy-[series]33) end do x ************************ * store data * ************************ smpl 1979:4 2001:3 open copy table2forecasts.XLS copy(org=obs,format=xls,dates) / [series] 18 to 33 close copy open copy table2squarederrors.XLS copy(org=obs,format=xls,dates) / [series] 34 to 49 close copy open copy table2xproducts.XLS copy(org=obs,format=xls,dates) / [series] 50 to 64 close copy ******************** * Compute error squared ******************** Make sematrix 1990:1 2001:3 # 34 to 49 Make cpemat 1990:1 2001:3 # 50 to 64 decl vector mse(16) decl vector mcpe(15) dofor x = 1 to 16 compute mse(x) = %sum(%xcol(sematrix,x)) / %rows(sematrix) end do x compute rmse = %sqrt(mse) write rmse dofor x = 1 to 15 compute mcpe(x) = %sum(%xcol(cpemat,x)) / %rows(cpemat) end do x write mcpe write mse compute [vect] armse = ||mse(16),mse(16),mse(16),mse(16),mse(16),$ mse(16),mse(16),mse(16),mse(16),mse(16),$ mse(16),mse(16),mse(16),mse(16),mse(16) || compute labormse = %xsubmat(mse,1,15,1,1) write labormse compute p = %rows(sematrix) write p ******************************************************************************************** ******************************************************************************************** * Table3.prg * This program generated table 3 ******************************************************************************************** ******************************************************************************************** Cal 1966 1 12 all 2002:11 open data tab3.rat data(format=rats) / LIC1 LIC2 LIC3 LIC4 LIC5 LIU1 LIU2 LIU3 LIU4 LIU5 LICM LIUM LANAGRA LIPRIVA LTU LF close data * table **16 SERIES LOADED INTO PROGRAM *Transform independent variables into monthly growth rates set dlic1 / = (log(lic1) - log(licm{1})) * 100 set dlic2 / = (log(lic2) - log(licm{1})) * 100 set dlic3 / = (log(lic3) - log(licm{1})) * 100 set dlic4 / = (log(lic4) - log(licm{1})) * 100 set dlic5 / = (log(lic5) - log(licm{1})) * 100 set dliu1 / = (log(liu1) - log(lium{1})) * 100 set dliu2 / = (log(liu2) - log(lium{1})) * 100 set dliu3 / = (log(liu3) - log(lium{1})) * 100 set dliu4 / = (log(liu4) - log(lium{1})) * 100 set dliu5 / = (log(liu5) - log(lium{1})) * 100 **INDEPENDENT VARS USED IN REGRESSIONS ARE SERIES 17-26 *Transform Labor Market vars to monthly growth rates set dlanagra / = (log(lanagra) - log(lanagra{1})) * 100 set dlipriva / = (log(lipriva) - log(lipriva{1})) * 100 set UR / = (ltu/lf) * 100 **DEPENDENT VARS USED IN REGRESSIONS ARE SERIES 27,28,29 decl rect[real] Table3(11,9) ************************************************* **** UNEMPLOYMENT RATE REGRESSIONS ************ ************************************************* smpl 1968:02 2001:11 linreg(noprint) ur # constant ur{1 to 12} compute table3(1,1) = 0 compute Table3(1,2) = 0 compute Table3(1,3) = %seesq**.5 Dofor x = 17 to 26 linreg(noprint) ur # constant x ur{1 to 12} compute table3(x-15,1) = %beta(2) compute Table3(x-15,2) = %tstats(2) compute Table3(x-15,3) = %seesq**.5 end dofor x ************************************************* **** payroll jobs -- LANAGRA REGRESSIONS ********************** ************************************************* smpl 1968:02 2001:11 linreg(noprint) dlanagra # constant dlanagra{1 to 12} compute table3(1,4) = 0 compute Table3(1,5) = 0 compute Table3(1,6) = %seesq**.5 Dofor x = 17 to 26 linreg(noprint) dlanagra # constant x dlanagra{1 to 12} compute table3(x-15,4) = %beta(2) compute Table3(x-15,5) = %tstats(2) compute Table3(x-15,6) = %seesq**.5 end dofor x ************************************************* **** hours worked -- LIPRIVA REGRESSIONS ********************** ************************************************* * decl rect[real] Table3(11,9) smpl 1968:02 2001:11 linreg(noprint) dlipriva # constant dlipriva{1 to 12} compute table3(1,7) = 0 compute Table3(1,8) = 0 compute Table3(1,9) = %seesq**.5 Dofor x = 17 to 26 linreg(noprint) dlipriva # constant x dlipriva{1 to 12} compute table3(x-15,7) = %beta(2) compute Table3(x-15,8) = %tstats(2) compute Table3(x-15,9) = %seesq**.5 end dofor x WRITE table3 ******************************************************************************************** ******************************************************************************************** * Table4.prg * This program generated table 4 ******************************************************************************************** ******************************************************************************************** Cal 1966 1 12 all 2002:11 open data tab4.rat data(format=rats) / LIC1 LIC2 LIC3 LIC4 LIC5 LIU1 LIU2 LIU3 LIU4 LIU5 LICM LIUM LANAGRA LIPRIVA LTU LF close data **16 SERIES LOADED INTO PROGRAM *Transform independent variables into monthly growth rates set dlic1 / = (log(lic1) - log(licm{1})) * 100 set dlic2 / = (log(lic2) - log(licm{1})) * 100 set dlic3 / = (log(lic3) - log(licm{1})) * 100 set dlic4 / = (log(lic4) - log(licm{1})) * 100 set dlic5 / = (log(lic5) - log(licm{1})) * 100 set dliu1 / = (log(liu1) - log(lium{1})) * 100 set dliu2 / = (log(liu2) - log(lium{1})) * 100 set dliu3 / = (log(liu3) - log(lium{1})) * 100 set dliu4 / = (log(liu4) - log(lium{1})) * 100 set dliu5 / = (log(liu5) - log(lium{1})) * 100 **INDEPENDENT VARS USED IN REGRESSIONS ARE SERIES 17-26 *Transform Labor Market vars to monthly growth rates set UR / = (ltu/lf) * 100 set dlanagra / = (log(lanagra) - log(lanagra{1})) * 100 set dlipriva / = (log(lipriva) - log(lipriva{1})) * 100 **DEPENDENT VARS USED IN REGRESSIONS ARE SERIES 27,28,29 ************************************************* **** UNEMPLOYMENT RATE REGRESSIONS ************ ************************************************* decl vector[series] URFor(11) * First estimation period ends in 1990:06, last forecast data pt=2001:11 * Creates recursive UR forecast series 30 to 40 from July 1990 to Nov 2001 Dofor x = 17 to 26 do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) UR # constant x UR{1 to 12} prj ((x+29)-16) 1990:06+i 1990:06+i end do i end dofor x do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) UR # constant UR{1 to 12} prj (40) 1990:06+i 1990:06+i end do i ************************************************* **** LANAGRA REGRESSIONS ********************** ************************************************* decl vector[series] jobsFor(11) *First estimation period ends in 1990:06, last forecast data pt=2001:11 * Creates recursive Jobs forecast series 41 to 51 from July 1990 to Nov 2001 Dofor x = 17 to 26 do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlanagra # constant x dlanagra{1 to 12} prj ((x+40)-16) 1990:06+i 1990:06+i end do i end dofor x do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlanagra # constant dlanagra{1 to 12} prj (51) 1990:06+i 1990:06+i end do i ************************************************* **** LIPRIVA REGRESSIONS ********************** ************************************************* decl vector[series] hoursFor(11) * First estimation period ends in 1990:06, last forecast data pt=2001:11 * Creates recursive hours forecast series 52 to 62 from July 1990 to Nov 2001 Dofor x = 17 to 26 do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlipriva # constant x dlipriva{1 to 12} prj ((x+51)-16) 1990:06+i 1990:06+i end do i end dofor x do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlipriva # constant dlipriva{1 to 12} prj (62) 1990:06+i 1990:06+i end do i smpl 1990:07 2001:11 *************************************************** * creates series of squared errors numbered 63 to 95 *************************************************** decl vector[series] sqerrors(33) dofor x = 30 to 40 set [series]x+33 = (UR-[series]x)**2 end do x dofor x = 41 to 51 set [series]x+33 = (dlanagra-[series]x)**2 end do x dofor x = 52 to 62 set [series]x+33 = (dlipriva-[series]x)**2 end do x *************************************************** * creates series of error cross products numbered 96 to 125 *************************************************** decl vector[series] cperrors(30) dofor x = 30 to 39 set [series]x+66 = (ur-[series]x)*(ur-[series]40) end do x dofor x = 41 to 50 set [series]x+65 = (dlanagra-[series]x)*(dlanagra-[series]51) end do x dofor x = 52 to 61 set [series]x+64 = (dlipriva-[series]x)*(dlipriva-[series]62) end do x ************************ * store data * ************************ /* table open copy table4forecasts.XLS copy(org=obs,format=xls,dates) / [series] 30 to 62 close copy open copy table4squarederrors.XLS copy(org=obs,format=xls,dates) / [series] 63 to 95 close copy open copy table4xproducts.XLS copy(org=obs,format=xls,dates) / [series] 96 to 125 close copy */ ******************** * Compute error squared ******************** Make sematrix 1990:07 2001:11 # 63 to 95 Make cpemat 1990:07 2001:11 # 96 to 125 decl vector mse(33) decl vector mcpe(30) dofor x = 1 to 33 compute mse(x) = %sum(%xcol(sematrix,x)) / %rows(sematrix) end do x compute rmse = %sqrt(mse) write rmse dofor x = 1 to 30 compute mcpe(x) = %sum(%xcol(cpemat,x)) / %rows(cpemat) end do x write mcpe write mse compute p = %rows(sematrix) write p open copy RMSE&mcpe.TXT WRITE(UNIT=COPY) 'RMSE' RMSE 'Mcpe' McpE close copy ******************************************************************************************** ******************************************************************************************** * Table5.prg * This program generated table 5 ******************************************************************************************** ******************************************************************************************** Cal 1966 1 12 all 2002:11 open data tab5.rat data(format=rats) / LIC1 LIC2 LIC3 LIC4 LIC5 LIU1 LIU2 LIU3 LIU4 LIU5 LICM LIUM LANAGRA LIPRIVA LTU LF close data **16 SERIES LOADED INTO PROGRAM *Transform independent variables into monthly growth rates set dlic1 / = (log(lic1) - log(licm{1})) * 100 set dlic2 / = (log(lic2) - log(licm{1})) * 100 set dlic3 / = (log(lic3) - log(licm{1})) * 100 set dlic4 / = (log(lic4) - log(licm{1})) * 100 set dlic5 / = (log(lic5) - log(licm{1})) * 100 set dliu1 / = (log(liu1) - log(lium{1})) * 100 set dliu2 / = (log(liu2) - log(lium{1})) * 100 set dliu3 / = (log(liu3) - log(lium{1})) * 100 set dliu4 / = (log(liu4) - log(lium{1})) * 100 set dliu5 / = (log(liu5) - log(lium{1})) * 100 **INDEPENDENT VARS USED IN REGRESSIONS ARE SERIES 17-26 *Transform Labor Market vars to monthly growth rates set UR / = (ltu/lf) * 100 set dlanagra / = (log(lanagra) - log(lanagra{1})) * 100 set dlipriva / = (log(lipriva) - log(lipriva{1})) * 100 **DEPENDENT VARS USED IN REGRESSIONS ARE SERIES 27,28,29 ************************************************* **** UNEMPLOYMENT RATE REGRESSIONS ************ ************************************************* decl vector[series] URFor(11) * First estimation period ends in 1990:06, last forecast data pt=2001:11 * Creates recursive UR forecast series 30 to 40 from July 1990 to Nov 2001 Dofor x = 17 to 26 do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) UR # constant x UR{1 to 12} prj ((x+29)-16) 1990:06+i 1990:06+i end do i end dofor x do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) UR # constant UR{1 to 12} prj (40) 1990:06+i 1990:06+i end do i ************************************************* **** LANAGRA REGRESSIONS ********************** ************************************************* decl vector[series] jobsFor(11) *First estimation period ends in 1990:06, last forecast data pt=2001:11 * Creates recursive Jobs forecast series 41 to 51 from July 1990 to Nov 2001 Dofor x = 17 to 26 do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlanagra # constant x dlanagra{1 to 12} prj ((x+40)-16) 1990:06+i 1990:06+i end do i end dofor x do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlanagra # constant dlanagra{1 to 12} prj (51) 1990:06+i 1990:06+i end do i ************************************************* **** LIPRIVA REGRESSIONS ********************** ************************************************* decl vector[series] hoursFor(11) * First estimation period ends in 1990:06, last forecast data pt=2001:11 * Creates recursive hours forecast series 52 to 62 from July 1990 to Nov 2001 Dofor x = 17 to 26 do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlipriva # constant x dlipriva{1 to 12} prj ((x+51)-16) 1990:06+i 1990:06+i end do i end dofor x do i = 1,137 smpl 1968:02 1990:05+i linreg(noprint) dlipriva # constant dlipriva{1 to 12} prj (62) 1990:06+i 1990:06+i end do i smpl 1990:07 2001:11 *************************************************** * creates series of squared errors numbered 63 to 95 *************************************************** decl vector[series] sqerrors(33) dofor x = 30 to 40 set [series]x+33 = (UR-[series]x)**2 end do x dofor x = 41 to 51 set [series]x+33 = (dlanagra-[series]x)**2 end do x dofor x = 52 to 62 set [series]x+33 = (dlipriva-[series]x)**2 end do x *************************************************** * creates series of error cross products numbered 96 to 125 *************************************************** decl vector[series] cperrors(30) dofor x = 30 to 39 set [series]x+66 = (ur-[series]x)*(ur-[series]40) end do x dofor x = 41 to 50 set [series]x+65 = (dlanagra-[series]x)*(dlanagra-[series]51) end do x dofor x = 52 to 61 set [series]x+64 = (dlipriva-[series]x)*(dlipriva-[series]62) end do x ************************ * store data * ************************ /* table open copy table4forecasts.XLS copy(org=obs,format=xls,dates) / [series] 30 to 62 close copy open copy table4squarederrors.XLS copy(org=obs,format=xls,dates) / [series] 63 to 95 close copy open copy table4xproducts.XLS copy(org=obs,format=xls,dates) / [series] 96 to 125 close copy */ ******************** * Compute error squared ******************** Make sematrix 1991:04 2001:2 # 63 to 95 Make cpemat 1990:04 2001:2 # 96 to 125 decl vector mse(33) decl vector mcpe(30) dofor x = 1 to 33 compute mse(x) = %sum(%xcol(sematrix,x)) / %rows(sematrix) end do x compute rmse = %sqrt(mse) write rmse dofor x = 1 to 30 compute mcpe(x) = %sum(%xcol(cpemat,x)) / %rows(cpemat) end do x write mcpe write mse compute p = %rows(sematrix) write p open copy RMSE&mcpe.TXT WRITE(UNIT=COPY) 'RMSE' RMSE 'Mcpe' McpE close copy