res84529 wrote:Hi Tom,
Thank you so much for your help!
I also tried horizontal concatenation with the following code before I looked at your answer:
ewise %%responses(draw)(i,j)=ix=%vec(%xsubmat(%xt(acumirf,j),1,nvar,3,3)~%xsubmat(%xt(acumirf,j),1,nvar,6,7)),ix(i)
It works. In addition, I'm confused about the meaning of the part of the code which is originally from UG p. 498:
impulses((i-1)/nvar+1,%clock(i,nvar))(j)
Could you please explain to me what's the meaning of "(i-1)/nvar+1,%clock(i,nvar)"? what's the use of it?
The set of impulse responses would best be represented as a three dimensional array (step, shock, target variable) and we need one matrix like that per draw, so you really would want a four dimensional array. Lacking that, you need to map everything down to fewer dimensions. In this case, it's a VECTOR (over the draws) of RECT, which is a two-dimensional array with steps in the columns and shocks x target variables in the rows. With the combined subscripts blocked by shocks, the (i-1)/nvar+1 maps the combined subscripts to the target variable and %clock(i,nvar) to the shock. The coding for this in the RATS v8 UG is the simpler:
ewise %%responses(draw)(i,j)=ix=%vec(%xt(impulses,j)),ix(i)
which does exactly the same thing.
res84529 wrote:In addition, why should we repeat with another ix(i) after already defining it in the ewise instruction above since there's no such requirement in the standard ewise instruction setup?
Best Regards
EWISE has an internal loop over i and j and needs to have an expression which evaluates to a single number. The IX calculation creates a VECTOR based upon desired value of the J subscript (which is the step); IX(I) then takes the Ith element out of that to make %%responses(draw)(i,j)