Non-Cholesky factorisation

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Albert0
Posts: 6
Joined: Fri Dec 09, 2016 3:59 am

Non-Cholesky factorisation

Postby Albert0 » Fri Dec 09, 2016 11:52 am

Hi all,

I am trying to modify a code in which a svar is estimated. In particular, what I want to do is to change the factorisation matrix which in the original is a standard triangular Cholesky, introducing an over identifying restriction. I am not good at programming in eViews but I think the part of the code I have to change is the following:

Code: Select all

matrix A1= @cholesky(qresidcov)
Is there a simple way of doing this?

Many thanks,
Alberto

EViews Matt
EViews Developer
Posts: 583
Joined: Thu Apr 25, 2013 7:48 pm

Re: Non-Cholesky factorisation

Postby EViews Matt » Fri Dec 09, 2016 12:34 pm

Am I correct in assuming that you currently have a reduced-form VAR, e.g., y = <lagged y terms> + A1 * u, and you now want to change the specification for A1? Take a look at the SVAR documentation and you'll see that you can easily specify this form of VAR using two "pattern" matrices. The documentation refers to the pattern matrices as A and B, and in your case A would be the identity matrix and B would be a lower triangular matrix with the new restriction(s) you want. You can then use your VAR object's "svar" proc to estimate your new A1.

Albert0
Posts: 6
Joined: Fri Dec 09, 2016 3:59 am

Re: Non-Cholesky factorisation

Postby Albert0 » Sun Dec 11, 2016 8:43 am

Hi Matt, thank you for your reply.

Yes, your assumption is correct. Actually, I am interested in the long run case, so I have to find the "C" matrix in the documentation you posted.
After several attemps and after looking at other eviews programming guides, I managed to write this part of code that seems to work pretty well:

Code: Select all

varest.cleartext(svar) varest.append(svar) @lr1(@u2)=0 varest.append(svar) @lr1(@u3)=0 varest.append(svar) @lr1(@u4)=0 varest.append(svar) @lr2(@u3)=0 varest.append(svar) @lr2(@u4)=0 varest.append(svar) @lr3(@u4)=0 varest.svar(rtype=text,conv=1e-5) matrix matb = varest.@svarbmat
The example is for the Cholesky case and I get the same matb matrix as in my original code. The only problem is that this procedure does not seem to store in any way the "C" matrix I need.
I would be grateful if you could give me your opinion on the code above and on how to save the "C" matrix.

Thanks a lot,
Alberto

EViews Matt
EViews Developer
Posts: 583
Joined: Thu Apr 25, 2013 7:48 pm

Re: Non-Cholesky factorisation

Postby EViews Matt » Mon Dec 12, 2016 10:47 am

The most concise way to recover the C matrix is to utilize the the coefficients that are saved in the "c" object of the workfile page when you run the var's "svar" procedure. Basically, you recreate the long-run pattern matrix shown in the SVAR results table, but include the estimated values. For example,

Code: Select all

matrix(4,4) matc matc.fill c(1), c(2), c(3), c(4), 0, c(5), c(6), c(7), 0, 0, c(8), c(9), 0, 0, 0, c(10)
Less concise, and less numerically attractive, would be to calculate Ψ and multiply it by the estimated B matrix. The only advantage of that approach is that you don't need to reenter the pattern structure. If you find yourself needing to do a lot of these types of SVARs, it would probably be worthwhile to specify the long-run restrictions via a pattern matrix, e.g.,

Code: Select all

matrix(4,4) patc patc.fill na, na, na, na, 0, na, na, na, 0, 0, na, na, 0, 0, 0, na
and then write a subroutine that uses the pattern matrix and the "c" object to recover the C matrix.
Last edited by EViews Matt on Tue Dec 13, 2016 12:51 pm, edited 1 time in total.

Albert0
Posts: 6
Joined: Fri Dec 09, 2016 3:59 am

Re: Non-Cholesky factorisation

Postby Albert0 » Tue Dec 13, 2016 12:28 pm

Thank you again Matt, your method works perfectly.

Just a note: I think you miswrote the first command that should be:

Code: Select all

matrix(4,4) matc

EViews Matt
EViews Developer
Posts: 583
Joined: Thu Apr 25, 2013 7:48 pm

Re: Non-Cholesky factorisation

Postby EViews Matt » Tue Dec 13, 2016 12:52 pm

Quite right, I've edited my previous post to correct it. That's what I get for retyping rather than cut-n-paste. :D


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest