Jorda(2005)—Local Projection Impulse Responses

Use this forum for posting example programs or short bits of sample code.
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Jorda(2005)—Local Projection Impulse Responses

Unread post by TomDoan »

https://estima.com/procedures/jordaaer2005.zip computes the impulse responses by local projections from Jorda(2005), "Estimation and Inference of Impulse Responses by Local Projections", American Economic Review, 95(1), pp 161-182. This does the New Keynesian model example (3 variable VAR using Cholesky factor shocks).

Detailed Description
twada
Posts: 2
Joined: Sun Mar 19, 2017 11:32 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by twada »

Dear Tom,

Thanks so much for the sample code! I have the following 2 questions:
1. It seems that the number of observations used to get the local projection IR changes (decreases) as h increases. Am I right? Some of the sample codes posted on Oscar Jorda's website uses the same number of observations for all horizons, h=0, 1,....,hmax.
2. I think there is local projection IR for h=0 (which is just the Cholesky matrix times shock), and h=2, 3,... but I am wondering is there is no IR for h=1. I am sorry if I am wrong.

Thanks for your time,
Tatsuma
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by TomDoan »

twada wrote:Dear Tom,

Thanks so much for the sample code! I have the following 2 questions:
1. It seems that the number of observations used to get the local projection IR changes (decreases) as h increases. Am I right? Some of the sample codes posted on Oscar Jorda's website uses the same number of observations for all horizons, h=0, 1,....,hmax.
I don't think there's a strong reason to prefer one vs the other.
twada wrote: 2. I think there is local projection IR for h=0 (which is just the Cholesky matrix times shock), and h=2, 3,... but I am wondering is there is no IR for h=1. I am sorry if I am wrong.
You're correct. I've fixed the program. Note that the labeling of the responses in the paper is wrong---the h=1 really are the impact shocks.
twada
Posts: 2
Joined: Sun Mar 19, 2017 11:32 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by twada »

Thanks, Tom. I checked the code and confirmed that my results are the same as yours.
Thanks also for pointing out the difference between the figures in the paper and those by Rats's.

Tatsuma
ABDHUT123
Posts: 13
Joined: Thu Aug 02, 2018 9:37 am

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by ABDHUT123 »

Dear Tom, how to obtain the local projection impulse response along with corresponding standard errors in table format??
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by TomDoan »

The linear projection IRF's are in LINPRJIRF(i,j) and the corresponding standard errors are in LINPRJSTDERR(i,j) where i is the target variable and j is the shock. I'm not sure how you want to organize a table of those, but you can use PRINT or COPY to get the values.
Ozmando
Posts: 52
Joined: Sun Jul 15, 2012 4:04 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by Ozmando »

TomDoan wrote:This computes the impulse responses by local projections from Jorda(2005), "Estimation and Inference of Impulse Responses by Local Projections", American Economic Review, 95(1), pp 161-182. This does the New Keynesian model example (3 variable VAR using Cholesky factor shocks).
is_example.rpf
is_new.csv
The calculations for this are actually quite simple. The h step responses are computed by regressing Y(t) on Y(t-h), Y(t-(h+1)), ... and extracting the coefficient vector on the leading lag (that is, the Y(t-h)) in that. That n x n matrix gives the local projection responses of the n variables (rows) to unit shocks in the n variables (columns). Different shock patterns can be obtained by post-multiplying that matrix by a set of weights on the unit shocks (in this case, by the Cholesky factor of the residuals from a standard VAR). (Standard IRF's effectively do the same thing for multi-step responses except the multi-step projection is a known function of the standard VAR coefficients rather than being estimated directly).

The regression with skipped lags will have serially correlated errors. The standard errors of the IRF's are computed using some form of HAC covariance estimates for that lead coefficient matrix. Because there are different ways of computing those, the standard errors will differ as well.

A few things to note.
  1. The graphs in the RATS program label the impact shock as 0 (as is more typical) while Jorda uses 1.
  2. The RATS graphs are organized in the more typical way with variables across and shocks down. They also use a common scale going across for all responses of a given variable.
  3. This does not do the cubic projections. That's not dramatically more complicated, but it's not clear that there's a great advantage to it, and the cubic responses have to be linearized about some value for the lagged y's anyway (which the linear projection responses are independent of those).
I am trying to modify the code so that the graphs are generated individually rather than in the 3 by 3 format as it is now; Any help please? Thanks.
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by TomDoan »

You have to comment out the SPGRAPH instructions (two lines at the top, one at the bottom):
*spgraph(hfields=nshock,vfields=%nvar,xlabels=varlabels,ylabels=shocklabels,$
*   footer="Figure 5. Impulse Responses for the New Keynesian Model based on a VAR and Linear Projections")
 do i=1,%nvar
   *
   * Compute the upper and lower bounds for each of the responses
   * for variable i, then find the max and min across all the shocks
   *
   do j=1,nshock
      set lower(j) 1 nstep+1 = linprjirf(i,j)-2.0*linprjstderr(i,j)
      set upper(j) 1 nstep+1 = linprjirf(i,j)+2.0*linprjstderr(i,j)
   end do j
   table(noprint) 1 nstep+1 lower upper
   do j=1,nshock
      graph(row=i,col=j,number=0,min=%minimum,max=%maximum) 4
      # baseirf(i,j)
      # linprjirf(i,j)
      # lower(j) / 3
      # upper(j) / 3
   end do j
 end do i
*spgraph(done)
That also eliminates the labeling, so you would have to add a header or footer option to the GRAPH instruction.
Ozmando
Posts: 52
Joined: Sun Jul 15, 2012 4:04 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by Ozmando »

TomDoan wrote:You have to comment out the SPGRAPH instructions (two lines at the top, one at the bottom):
*spgraph(hfields=nshock,vfields=%nvar,xlabels=varlabels,ylabels=shocklabels,$
*   footer="Figure 5. Impulse Responses for the New Keynesian Model based on a VAR and Linear Projections")
 do i=1,%nvar
   *
   * Compute the upper and lower bounds for each of the responses
   * for variable i, then find the max and min across all the shocks
   *
   do j=1,nshock
      set lower(j) 1 nstep+1 = linprjirf(i,j)-2.0*linprjstderr(i,j)
      set upper(j) 1 nstep+1 = linprjirf(i,j)+2.0*linprjstderr(i,j)
   end do j
   table(noprint) 1 nstep+1 lower upper
   do j=1,nshock
      graph(row=i,col=j,number=0,min=%minimum,max=%maximum) 4
      # baseirf(i,j)
      # linprjirf(i,j)
      # lower(j) / 3
      # upper(j) / 3
   end do j
 end do i
*spgraph(done)
That also eliminates the labeling, so you would have to add a header or footer option to the GRAPH instruction.
Thanks Tom, working perfectly now.
However, VAR and LLP response are plotted in the same graph (please see example 1 attached). I am only interested in the LLP plots. Please how doI get rid off of the VAR response?
Thanks.
Attachments
Example1.RGF
(668 Bytes) Downloaded 1358 times
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by TomDoan »

Change this to graph 3 rather than 4, and delete the # baseirf(i,j) line

graph(row=i,col=j,number=0,min=%minimum,max=%maximum) 4
# baseirf(i,j)
# linprjirf(i,j)
# lower(j) / 3
# upper(j) / 3
Ozmando
Posts: 52
Joined: Sun Jul 15, 2012 4:04 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by Ozmando »

TomDoan wrote:Change this to graph 3 rather than 4, and delete the # baseirf(i,j) line

graph(row=i,col=j,number=0,min=%minimum,max=%maximum) 4
# baseirf(i,j)
# linprjirf(i,j)
# lower(j) / 3
# upper(j) / 3

Thanks Tom. All working fine now. Much appreciated.
Oz
TR2018
Posts: 9
Joined: Tue Nov 13, 2018 6:18 am

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by TR2018 »

Hello Toam,
dou you also have code for lag augmented Local projection impulse responses or any suggestion.
thanks
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Jorda(2005)—Local Projection Impulse Responses

Unread post by TomDoan »

TR2018 wrote: Thu Nov 07, 2024 7:20 am Hello Toam,
dou you also have code for lag augmented Local projection impulse responses or any suggestion.
thanks
There is nothing particularly difficult about that, but I am skeptical about any paper that cites Toda-Yamamoto as authority.
Post Reply