[R-SIG-Finance] [R-sig-finance] A VaR question
Matthieu Stigler
matthieu.stigler at gmail.com
Thu Nov 26 21:52:56 CET 2009
Hi RON70
Not sure about what you want to do... So you want to simulate a VAR with
those parameters? There is the function TVAR.simin package tsDyn that
allow you to simulate a VAR, see:
co<-matrix(c(0.985, 0.283, -1.714, 0.125, 1.100, -1.491,0.071,
-0.089, 1.388), ncol=3, byrow=TRUE)
library(tsDyn)
TVAR.sim(B=cbind(co,co),nthresh=0, inc="none", lag=2)
Hope this is what you wanted?
MAT2009
RON70 a écrit :
> I think I should be more clear on what I would like to do. From that
> estimated model I would like to get a "Real" VAR DGP, perhaps by tweaking
> some of the coeficients. Which I would use to simulate artrificial data, for
> some study. If somebody shows me some lihgt on how I can achive that, I
> would be truly grateful.
>
> Best,
>
>
>
> RON70 wrote:
>
>> Hi all,
>>
>> My problem seems to be bizzare, however I want to do like that. Here I
>> have estimated a VECM model from my dataset (seems not stationary) and
>> once I converted those into a VAR representation I have following
>> estimates :
>>
>>
>>> A1; A2; A3; A4
>>>
>> V1 V2 V3
>> 1 0.985 0.283 -1.714
>> 2 0.125 1.100 -1.491
>> 3 0.071 -0.089 1.388
>> V1 V2 V3
>> 1 0.258 -0.493 1.459
>> 2 0.252 -0.387 1.165
>> 3 -0.057 0.076 -0.536
>> V1 V2 V3
>> 1 0.332 -0.459 0.251
>> 2 0.482 -0.686 0.313
>> 3 0.112 -0.104 0.218
>> V1 V2 V3
>> 1 -0.532 0.624 -0.006
>> 2 -0.619 0.714 -0.044
>> 3 -0.129 0.121 -0.069
>>
>> Now I took them as an original DGP process and checked the solution of
>> it's ch. equation. I got following :
>>
>>
>>> library(PolynomF)
>>> z = polynom()
>>>
>>>
>>> p11 <- 1 - A1[1,1]*z - A2[1,1]*z^2 - A3[1,1]*z^3 - A4[1,1]*z^4
>>> p12 <- 0 - A1[1,2]*z - A2[1,2]*z^2 - A3[1,2]*z^3 - A4[1,2]*z^4
>>> p13 <- 0 - A1[1,3]*z - A2[1,3]*z^2 - A3[1,3]*z^3 - A4[1,3]*z^4
>>>
>>>
>>> p21 <- 0 - A1[2,1]*z - A2[2,1]*z^2 - A3[2,1]*z^3 - A4[2,1]*z^4
>>> p22 <- 1 - A1[2,2]*z - A2[2,2]*z^2 - A3[2,2]*z^3 - A4[2,2]*z^4
>>> p23 <- 0 - A1[2,3]*z - A2[2,3]*z^2 - A3[2,3]*z^3 - A4[2,3]*z^4
>>>
>>> p31 <- 0 - A1[3,1]*z - A2[3,1]*z^2 - A3[3,1]*z^3 - A4[3,1]*z^4
>>> p32 <- 0 - A1[3,2]*z - A2[3,2]*z^2 - A3[3,2]*z^3 - A4[3,2]*z^4
>>> p33 <- 1 - A1[3,3]*z - A2[3,3]*z^2 - A3[3,3]*z^3 - A4[3,3]*z^4
>>>
>>> p <- p11*(p22*p33 - p23*p32) - p12*(p21*p33 - p23*p31) + p13*(p21*p32 -
>>> p22*p31)
>>>
>>>
>>> abs(solve(p))
>>>
>> [1] 1.521516 2.102119 2.102119 4.912478 4.912478 1.000233 1.000233
>> 1.502034 1.502034 1.228100 2.536582 5.342635
>>
>> Now if I assume (upto a few significant digits) "1.000233 1.000233 " both
>> equal to "1" then, I am actually getting two unit roots here. Therefore I
>> am wondering how to tackle it as VAR is defined on max one unit root
>> process.
>>
>> Am I missing anything? Can anyone please help me?
>>
>> Best
>>
>>
>
>
More information about the R-SIG-Finance
mailing list