* * IMPULSES.RPF * RATS Version 8, User's Guide, Example 7.3 * Computing and graphing impulse responses. * open data oecdsample.rat calendar(q) 1981 data(format=rats) 1981:1 2006:4 can3mthpcp canexpgdpchs canexpgdpds $ canm1s canusxsr usaexpgdpch * * Scaling the log series by 100 gives the responses a more natural scale. * set logcangdp = 100.0*log(canexpgdpchs) set logcandefl = 100.0*log(canexpgdpds) set logcanm1 = 100.0*log(canm1s) set logusagdp = 100.0*log(usaexpgdpch) set logexrate = 100.0*log(canusxsr) * ************************************************************************* * * The only lines that need to be changed are the ones tagged with ;*<<<<<< * compute neqn = 6 ;*<<<<<< compute nlags = 5 ;*<<<<<< compute nsteps = 24 ;*<<<<<< * system(model=canmodel) variables logusagdp logexrate can3mthpcp logcanm1 logcangdp logcandefl ;*<<<<<<<< lags 1 to nlags det constant end(system) * * To help create publication-quality graphs, this sets longer labels for * the series. These are used both in graph headers and key labels. * compute [vect[strings]] implabel=|| $ ;* <<<<<< "US Real GDP",$ "Exchange Rate",$ "Short Rate",$ "M1",$ "Canada Real GDP",$ "CPI"|| estimate(noprint) * * The procedure VARIRF does the graphs shown below without the extra * programming. You can choose the graph pages to be organized by shocks * or by variables. * @VARIRF(model=canmodel,steps=nsteps,$ varlabels=implabel,page=byshocks) @VARIRF(model=canmodel,steps=nsteps,$ varlabels=implabel,page=byvariables) * declare rect[series] impblk(neqn,neqn) declare vect[series] scaled(neqn) declare vect[strings] implabel(neqn) * * These apply to the GRAPH instructions which are coming up later * list ieqn = 1 to neqn smpl 1 nsteps * * This computes the full set of impulse responses, which are in the * series in IMPBLK. IMPBLK(i,j) is the response of variable i to a shock * in j. * impulse(model=canmodel,result=impblk,noprint,$ steps=nsteps,cv=%sigma) * * This loop plots the responses of all series to a single series. The * response of a series is normalized by dividing by its innovation * variance. This allows all the responses to a shock to be plotted on a * single scale. Note that these graphs get a bit hard to read with more * than five or six variables. * do i=1,neqn compute header="Plot of responses to "+implabel(i) do j=1,neqn set scaled(j) = (impblk(j,i))/sqrt(%sigma(j,j)) end do j graph(header=header,key=below,klabels=implabel,number=0) neqn cards scaled(ieqn) end do i * * And this loop graphs the responses of a variable to all shocks. These * don’t have to be normalized. * do i=1,neqn compute header="Plot of responses of "+implabel(i) graph(header=header,key=below,klabels=implabel,number=0) neqn cards impblk(i,ieqn) end do i