Montevar using ffunction question

Questions and discussions on Vector Autoregressions
tomemmerling
Posts: 2
Joined: Mon Apr 18, 2016 1:52 pm

Montevar using ffunction question

Unread post by tomemmerling »

Hi Tom,
I'm trying to obtain confidence bounds for my impulse response graphs for a VAR using an alternative factorization for the G matrix (i.e., not Cholesky). I'm not sure what I'm doing wrong below in order to produce the graphs. I tried to create a function with the required type which returns the rectangular G matrix. However, I get an error saying otherwise--see below. I'm sure the problem is obvious but I really appreciate your help! Note I compute the covariance matrix "v" and define "model1" using the system command prior to the following code.

* ffunction definition
function myfcn vv model
type rectangular myfcn
type symmetric vv
type model model
*
nonlin g11 g12 g13 g15 g22 g23 g24 g31 g33 g34 g41 g44 g52 g53 g55
dec frml[rect] g_form
frml g_form = || g11, g12, g13, 0, g15| 0, g22, g23, g24, 0 | g31, 0, g33, g34, 0 | g41, 0, 0, g44,0 |0, g52 , g53 , 0, g55 ||
com g11 = vv(1,1), g12 = vv(1,2), g13 = vv(1,3), g15=vv(1,5), g22 = vv(2,2), g23=vv(2,3),g24=vv(2,4)
com g31 = vv(3,1), g33 = vv(3,3),g34=vv(3,4), g41=vv(4,1), g44 = vv(4,4), g52 = vv(5,2), g53 = vv(5,3),g55=vv(5,5)
cvmodel(factor=z,noprint) vv g_form
compute myfcn=z
end
disp myfcn(v,model1)

* call montevar with v and model1
@montevar(model=model1,steps=13,header="IRF's with Error Bands",ffunction=myfcn(v,model1))
## SX22. Expected Type FUNCTION(SYMMETRIC[REAL],MODEL)-->RECTANGULAR[REAL], Got RECTANGULAR[REAL] Instead
>>>>on=myfcn(v,model1))<<<<
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Montevar using ffunction question

Unread post by TomDoan »

If would just be

@montevar(model=model1,steps=13,header="IRF's with Error Bands",ffunction=myfcn)

However, your model fails the Rubio-Ramirez-Waggoner-Zha identification rules.
Post Reply