*
* @ImpactSignFlip factor signs
*
* This procedure is used to correct the signs of columns in a factor of
* a covariance matrix when the signs themselves may not be identified by
* the process of computing the factor. For instance, @ShortAndLong
* computes a factor based upon patterns of short- and long-run
* restrictions. Those are all zero restrictions, which means that for
* any factor, you can sign flip any column(s) and still satisfy all those
* zero restrictions. <> is a VECTOR[INT] with values +/- the
* variable on which you want to normalize the impact sign in the
* corresponding column. For instance, if you have a model which creates
* "aggregate supply" and "aggregate demand" (in order), that would
* usually be interpreted as meaning a positive impact on output. If the
* first variable in the model is output, this will make sure that the
* signs match that interpretation:
*
* @ImpactSignFlip bqfactor ||+1,+1||
*
* If the variables are GDP and inflation in order, and the first shock
* is supply (impact positive on GDP) and the second shock is
* contractionary monetary (negative impact on inflation), you would use
*
* @ImpactSignFlip factor ||+1,-2||
*
* Parameters
* factor (input/output) the RECTANGULAR factor to be adjusted
* signs VECTOR[INT] as described above
*
procedure ImpactSignFlip factor signs
type rect *factor
type vect[int] signs
*
if %size(signs)<>%cols(factor) {
disp "###@ImpactSignFlip. Dimension of Signs Array" %size(signs) "must match columns in factor" %cols(factor)
return
}
local vect flippers(%size(signs))
local integer i
*
ewise flippers(i)=%if(signs(i)<0,-%sign(factor(-signs(i),i)),%sign(factor(+signs(i),i)))
compute factor=%dmult(factor,flippers)
end