HELP WITH CONDITION.SRC

Questions and discussions on Vector Autoregressions
fabio fornari
Posts: 8
Joined: Fri Mar 20, 2009 7:11 am

HELP WITH CONDITION.SRC

Unread post by fabio fornari »

Dear Tom
I was trying to replicate the condition.src code for a usage within a Threshold Var model.
I got stuck with overlay, i.e. when you do

Code: Select all

overlay capr(1,constr) with overr(nsteps,nvar)
In the case i have where nsteps = 12, nvar = 4 and constr = 4 (2 per variable) what exactly does overlay?
Could you send me the lines of code that would exactly do what overlay does?
thanks for your help.
Fabio
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: HELP WITH CONDITION.SRC

Unread post by TomDoan »

OVERLAY allows you to have two matrices with different "shapes" but the same number of elements share the same space. In this case, you need a stacked up vector of size nsteps*nvar for doing the actual calculations, but for the purposes of setting things up, it's much more convenient to work with an nsteps x nvar rectangular array.

Code: Select all

overlay u(1) with uover(nsteps,nvar)
"overlays" the elements of the vector u with the elements of uover. If you change one, you change the other. We should really re-code that to replace those with the safer %vectorect and %vec functions. OVERLAY is a bit dangerous as if you re-dimension either matrix, you break the correspondence.

The syntax is

overlay element of existing array WITH dimension field

The element of existing array would be something like u(1) or uover(1,1), though it doesn't have to be the top or top corner. The dimension field is an array name followed by the dimensions that you want it to have.
Post Reply