*========================================================================== * * C:\PROJECT\ERM\GDPPOP\IMPULSE.PRG * * RATS code that graphs impulse response of GDP per capita given an ARMA. * Model identification from RATS program IDENTIFY.PRG. * *========================================================================== * cal 1947 1 4 compute t0 = 1947:1 ;* quarter of first observation compute tf = 1997:4 ;* quarter of last observation compute nstep = 16 ;* number of quarters to compute impulse responses all tf+nstep * * READ INPUT FILE AND COMPUTE PER CAPITA SERIES * open data gdppop.por data(format=portable) / gdp pop p16 * set gdp = gdp * 1000000000 ;* real GDP set gdpall = gdp / (pop * 1000000) ;* GDP / total population set gdp16 = gdp / (p16 * 1000000) ;* GDP / civilian noninstitutional pop * * LOG TRANSFORMATIONS * set lgdpall = log(gdpall) set lgdp16 = log(gdp16) * * TIME TRENDS * set trend = t set trend2 = (t ** 2) * * TIME DETREND ALL SERIES * linreg gdpall # constant trend trend2 prj fit set dgdpall = gdpall - fit * linreg gdp16 # constant trend trend2 prj fit set dgdp16 = gdp16 - fit * linreg lgdpall # constant trend trend2 prj fit set dlgdpall = lgdpall - fit * linreg lgdp16 # constant trend trend2 prj fit set dlgdp16 = lgdp16 - fit * open plot impulse.plt * * COMPUTE IMPULSE RESPONSES ON LEVEL TOTAL PER CAPITA SERIES * boxjenk(ar=2,diffs=0,ma=2,constant,iterations=50,define=eqn_dgdpall22) dgdpall impulse(noprint) 1 nstep 1 # eqn_dgdpall22 impres graph(nodates,header='Response: ARMA(2,2) on detrended total per capita levels') 1 # impres * boxjenk(ar=2,diffs=0,ma=1,constant,iterations=50,define=eqn_dgdpall21) dgdpall impulse(noprint) 1 nstep 1 # eqn_dgdpall21 impres graph(nodates,header='Response: ARMA(2,1) on detrended total per capita levels') 1 # impres * boxjenk(ar=3,diffs=0,ma=3,constant,iterations=50,define=eqn_dgdpall33) dgdpall impulse(noprint) 1 nstep 1 # eqn_dgdpall33 impres graph(nodates,header='Response: ARMA(3,3) on detrended total per capita levels') 1 # impres * boxjenk(ar=1,diffs=0,ma=1,constant,iterations=50,define=eqn_dgdpall11) dgdpall impulse(noprint) 1 nstep 1 # eqn_dgdpall11 impres graph(nodates,header='Response: ARMA(1,1) on detrended total per capita levels') 1 # impres * * COMPUTE IMPULSE RESPONSES ON LEVEL 16+ PER CAPITA SERIES * boxjenk(ar=2,diffs=0,ma=2,constant,iterations=50,define=eqn_dgdp1622) dgdp16 impulse(noprint) 1 nstep 1 # eqn_dgdp1622 impres graph(nodates,header='Response: ARMA(2,2) on detrended 16+ per capita levels') 1 # impres * boxjenk(ar=2,diffs=0,ma=1,constant,iterations=50,define=eqn_dgdp1621) dgdp16 impulse(noprint) 1 nstep 1 # eqn_dgdp1621 impres graph(nodates,header='Response: ARMA(2,1) on detrended 16+ per capita levels') 1 # impres * boxjenk(ar=3,diffs=0,ma=3,constant,iterations=50,define=eqn_dgdp1633) dgdp16 impulse(noprint) 1 nstep 1 # eqn_dgdp1633 impres graph(nodates,header='Response: ARMA(3,3) on detrended 16+ per capita levels') 1 # impres * boxjenk(ar=1,diffs=0,ma=1,constant,iterations=50,define=eqn_dgdp1611) dgdp16 impulse(noprint) 1 nstep 1 # eqn_dgdp1611 impres graph(nodates,header='Response: ARMA(1,1) on detrended 16+ per capita levels') 1 # impres * * COMPUTE IMPULSE RESPONSES ON LOGGED TOTAL PER CAPITA SERIES * boxjenk(ar=2,diffs=0,ma=2,constant,iterations=50,define=eqn_dlgdpall22) dlgdpall impulse(noprint) 1 nstep 1 # eqn_dlgdpall22 impres graph(nodates,header='Response: ARMA(2,2) on detrended total per capita logs') 1 # impres * boxjenk(ar=2,diffs=0,ma=1,constant,iterations=50,define=eqn_dlgdpall21) dlgdpall impulse(noprint) 1 nstep 1 # eqn_dlgdpall21 impres graph(nodates,header='Response: ARMA(2,1) on detrended total per capita logs') 1 # impres * boxjenk(ar=3,diffs=0,ma=3,constant,iterations=50,define=eqn_dlgdpall33) dlgdpall impulse(noprint) 1 nstep 1 # eqn_dlgdpall33 impres graph(nodates,header='Response: ARMA(3,3) on detrended total per capita logs') 1 # impres * boxjenk(ar=1,diffs=0,ma=1,constant,iterations=50,define=eqn_dlgdpall11) dlgdpall impulse(noprint) 1 nstep 1 # eqn_dlgdpall11 impres graph(nodates,header='Response: ARMA(1,1) on detrended total per capita logs') 1 # impres * * COMPUTE IMPULSE RESPONSES ON LOGGED 16+ PER CAPITA SERIES * boxjenk(ar=2,diffs=0,ma=2,constant,iterations=50,define=eqn_dlgdp1622) dlgdp16 impulse(noprint) 1 nstep 1 # eqn_dlgdp1622 impres graph(nodates,header='Response: ARMA(2,2) on detrended 16+ per capita logs') 1 # impres * boxjenk(ar=2,diffs=0,ma=1,constant,iterations=50,define=eqn_dlgdp1621) dlgdp16 impulse(noprint) 1 nstep 1 # eqn_dlgdp1621 impres graph(nodates,header='Response: ARMA(2,1) on detrended 16+ per capita logs') 1 # impres * boxjenk(ar=3,diffs=0,ma=3,constant,iterations=50,define=eqn_dlgdp1633) dlgdp16 impulse(noprint) 1 nstep 1 # eqn_dlgdp1633 impres graph(nodates,header='Response: ARMA(3,3) on detrended 16+ per capita logs') 1 # impres * boxjenk(ar=1,diffs=0,ma=1,constant,iterations=50,define=eqn_dlgdp1611) dlgdp16 impulse(noprint) 1 nstep 1 # eqn_dlgdp1611 impres graph(nodates,header='Response: ARMA(1,1) on detrended 16+ per capita logs') 1 # impres