Page 1 of 1
Rubio Ramirez -Waggoner- Zha multiple shocks
Posted: Wed Mar 03, 2010 11:35 am
by KOBE24
dear Tom,
I have a stupid question.
I am trying to identify 3 shocks using Todd Clarke code, but the sign matrix does not work.
Usually, I take this code to separate elements and arrays
||1., 2| 3, 4||
but Todd uses this code just to separate elements.
comp signs = ||%NA|-1|-1|1|-1|%NA||
Hence, I can not separate arrays: if I try the other way, RATS is very slow and at the end it does not give me IRFs.
Sorry for bothering with such a silly question.
Thanks a lot!
Re: Rubio Ramirez -Waggoner- Zha multiple shocks
Posted: Wed Mar 03, 2010 12:00 pm
by KOBE24
Hi Tom,
apparently I managed to write the matrixs it follows for two shocks (supply and monetary policy)
**********************************************************************************************
comp signs = ||1|-1|%NA|%NA|%NA|%NA||,||%NA|-1|-1|1|-1|%NA||
**********************************************************************************************
But I got this error message
**********************************************************************************
## MAT17. Can't Use Column Range of 2 to 2 in %XCOL operation
The Error Occurred At Location 0655 of loop/block
Line 45 of loop/block
***********************************************************************************
Thanks for helping, when you have time!
Regards!
Re: Rubio Ramirez -Waggoner- Zha multiple shocks
Posted: Wed Mar 03, 2010 12:11 pm
by KOBE24
To be more precise, I post the code as in Todd.
The error comes at line "break", which I put in bold: until this point, RATS runs every line!
* Save the difference between the forecasts with and without and added shocks
* (and shift them into the slots 1,...,nhor) of <<goodhist>>.
*
ewise goodhist(accept,k)(i,j)=baseplus(j)(i+hstart-1)-base(j)(i+hstart-1)
end do k
*******************************************************************************
if accept>=nkeep
break
:105
end do subdraws
if accept>=nkeep
break
infobox(current=draws)
end do draws
Re: Rubio Ramirez -Waggoner- Zha multiple shocks
Posted: Wed Mar 03, 2010 12:26 pm
by moderator
I don't see how a BREAK instruction itself could generate that error. Based on the error message, it would have to be an instruction that included a call to %XCOL.
I would suggest that you use the "instruction location" information (rather than the line number, which you would have to count carefully from the proper starting point) to verify exactly which line is generating the error.
You may need to run your program using a command like:
source(echo) myprog.prg
in order to see the instruction location numbers prefixed to the lines in the loop. See Section 16.1 in the User's Guide for more on this.
Re: Rubio Ramirez -Waggoner- Zha multiple shocks
Posted: Wed Mar 03, 2010 1:03 pm
by KOBE24
Thanks for your point,
I will read section 16.1 and give back to you!
Re: Rubio Ramirez -Waggoner- Zha multiple shocks
Posted: Wed Mar 03, 2010 2:06 pm
by TomDoan
Note that there is no difference (other perhaps a (very) slight one in efficiency) between the RRWZ method and the code that we've used that do the multiple shocks sequentially. So don't knock yourself out trying to do a rewrite.
Re: Rubio Ramirez -Waggoner- Zha multiple shocks
Posted: Sun Mar 07, 2010 8:19 pm
by tclark
The matrix "signs" is set up to have rows = # variables and columns = # of shocks. To have multiple shocks, you need to unput the matrix to have multiple columns. I give an arbitrary example below. Recall that the "|" delineates rows, and a "," delineates rows.
** general matrix declaration as in program
dec rec signs(nvar,nshock) ;* a matrix with the signs to be imposed, for # shocks = nshock
* use a 1 for >= 0, -1 for <= 0, and %NA for unrestricted
** two-sign restriction example
comp signs = ||%NA,1|-1,1|-1,-1|1,-1|-1,%NA|%NA,%NA||