# [R-SIG-Finance] Cholesky Decomposition in Impulse Response Functions

Johannes Lips johannes.lips at gmail.com
Wed Sep 2 14:05:02 CEST 2015

```
On 02.09.2015 13:19, Johannes Lips wrote:
>
>
> On 02.09.2015 11:44, Brian G. Peterson wrote:
>> On 09/02/2015 03:37 AM, Johannes Lips wrote:
>>> I am wondering if there's a way to tell the irf() command, in which
>>> order the cholesky decompostion should have. In other words how can I
>>> tell the irf command in which way the simultaneous effects should be
>>> modeled? Is it somehow based on the order of the variables in the
>>> var.est object?
>>> It would be great, if someone could shed some light on this, because I
>>> also couldn't find anything on the internet.
>>
>> You didn't mention that you were speaking of the irf function from
>> package vars, but I'll proceed on that assumption.
>>
>> It seems that you can answer your own question by looking at the source.
>>
>> vars::irf dispatches to one of:
>>
>> vars:::irf.svarest
>> vars:::irf.svecest
>> vars:::irf.varest
>> vars:::irf.vec2var
>>
>> all of these, in turn, call
>>
>> vars:::.irf
>>
>> and/or an appropriate
>>
>> vars:::.bootirf[*]
>>
>> and/or an appropriate
>>
>> vars:::Phi.*
>>
>> function.
>>
>> from examination of the Phi functions, it appears that the recursive
>> portion you're looking for is there, and does the matrix math over
>> the inverse of the A matrix.
> Thanks Brian,
>
> yeah, sorry for not being more specific. I was talking about the irf()
> from the vars package, which is also used by tsDyn as far as I can tell.
> I will have a look into all these functions and will try to figure it
> out. I thought it might be documented somewhere, because it's fairly
> common in most other econometrics packages. (This is not meant as a
> rant!)
> But I don't know how we could improve the documentation of all these
> packages and functions.
>
> Regards,
> Johannes
Just for the record. One can change the order of the cholesky
decomposition by changing the order in the initial VAR() call. So it's
quite easy to get the desired outcome.

Regards,
Johannes
>
>>
>> However, the ordering of variables seems to be a simple lapply over
>> coef. in the coef methods.
>>
>> So, not quite an answer, but hopefully I've pointed you towards where