Problem with MONTEZHA.PRC

Questions and discussions on Vector Autoregressions
measilva

Problem with MONTEZHA.PRC

Unread post by measilva »

The procedure MONTEZHA.PRC shows how to implement Zha's procedure for overidentified BVAR. Well the code seems to work pretty well when the number of variables is exactly 6. When I run the code with more than 6, e.g., 7 variables, I got the following error message:

## MAT2. Matrices with Dimensions 6 x 1 and 7 x 1 Involved in %DOT Operation
The Error Occurred At Location 0102
Line 5 of loop/block

After some time I figured out that the problem seems to be related to the "deltas". The original code shows the following:

dec vect deltas(6)
compute deltas=||4.0,1.0,3.0,2.0,0.0,3.0||
ewise deltas(i)=%nobs-ncoef+(deltas(i)+3)
compute delta=3.5


When I change this piece of code to:

dec vect deltas(7)
compute deltas=||4.0,1.0,3.0,2.0,0.0,3.0,0.0||
ewise deltas(i)=%nobs-ncoef+(deltas(i)+3)
compute delta=4

The code works. Although I understand that the number of deltas must be consistent with the number of variables (right?), I do not know what the numbers in
"compute deltas=||4.0,1.0,3.0,2.0,0.0,3.0,0.0||" actually mean. Should the user define them? What's the intuition behind? Theory???

What are they? How should I choose the numbers? Why the sequence "4.0, 1.0, 3.0, 2.0,0.0,3.0" was chosen? For my specific problem (7 variables VAR) I randomly chosed the 7th number to be 0.0, but I have no idea how to pick a number for that.

Any help will be appreciated.

Thanks
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Problem with MONTEZHA.PRC

Unread post by TomDoan »

Those input deltas give the count of the number of free parameters in a column. In that example:

Code: Select all

dec frml[rect] afrml
frml afrml = ||1.0   ,ax(1),0.0   ,0.0   ,0.0 ,0.0|$
               ax(2) ,1.0  ,ax(3) ,ax(4) ,0.0 ,0.0|$
               ax(5) ,0.0  ,1.0   ,0.0   ,0.0 ,ax(6)|$
               ax(7) ,0.0  ,ax(8) ,1.0   ,0.0 ,ax(9)|$
               ax(10),0.0  ,ax(11),ax(12),1.0 ,ax(13)|$
               0.0   ,0.0  ,0.0   ,0.0   ,0.0 ,1.0||

dec vect deltas(6)
compute deltas=||4.0,1.0,3.0,2.0,0.0,3.0||
It's the minimum number to guarantee an integrable posterior.
bonilla
Posts: 6
Joined: Wed Aug 01, 2012 10:12 am

Re: Problem with MONTEZHA.PRC

Unread post by bonilla »

After all the suggested modifications, the procedure MONTEZHA.PRC works fine with 7 variables. Nevertheless, each time that I run the same code with the same data the covariance matrix change, and so do the responses function and forecast error. I am not sure if that is ok or there are a problem.

I would appreciate any advice.

Thanks a lot!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Problem with MONTEZHA.PRC

Unread post by TomDoan »

What covariance matrix is changing? It's a Monte Carlo integration program, so the error bands will change from run to run unless you use a SEED instruction.

MONTEZHA is from an older version of RATS and a modernized version is available for version 7 or later with MONTESVAR.
bonilla
Posts: 6
Joined: Wed Aug 01, 2012 10:12 am

Re: Problem with MONTEZHA.PRC

Unread post by bonilla »

The matrix changing is the "swish" which, according to my understanding, is the var-cov matrix of the SVAR. I will try with MONTESVAR procedure. Thanks !
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Problem with MONTEZHA.PRC

Unread post by TomDoan »

In MONTEZHA, SWISH is a factor of a draw for sigma so it does change as you do draws. The covariance matrix of the OLS residuals is VMAT.
Post Reply