[R-SIG-Finance] [R-sig-finance] Creating a VCEM data generating process
Matthieu Stigler
matthieu.stigler at gmail.com
Tue Jun 30 19:17:30 CEST 2009
Hi
To simulate a VECM you could look in package vars in the impulse
response functions, as this implements a bootstrap procedure.However,
this is rather a low level function and it is based I think on the VMA
representation.
I implemented functions to simulate VAR and VECM in package tsDyn. The
TVECM.sim() can only simulate bivariate models, whereas the TVAR.sim()
can handle multiple variables. Examples pages for these functions
include code to reproduce the examples in Enders. If you want to play
with more than 2 variables, you could convert your VECM into a VAR with
function vec2var() from package vars (you will need to cheat) and then
use the var coef for TVAR.sim(). or just simply write yourself a
function to simulate a VAR, should not be too complicated.
Here is a code to simulate trivariate VAR:
B1<-matrix(c(0.7, 0.2, 0.2, 0.2, 0.1, 0.3,0.1, 0.1, 0.3), nrow=3)
var1<-TVAR.sim(B=B1,nthresh=0,n=100, lag=1,type="simul", include="none",
show.parMat=TRUE)
ts.plot(var1, type="l", col=1:3)
The arg varcov allows to specify the complete var-cov matrix of errors
and hence have cross-correlation. If you want more complicated
structures, create your erros series and input is with arg innov.
Note that this is with dev version of package tsDyn
(http://code.google.com/p/tsdyn/wiki/ThresholdCointegration) that you
will need to compile. A new version should come soon (next week).
Let us know if you find any interesting/illustrative examples of
VAR/VECM simulation.
I do agree with Mark concerning the books. Lutkepohl is the last book to
read... first read after Enders, then Hamilton and then Lutkpohl!
Bests
Matthieu
RON70 a écrit :
> Thank you so much for this. If you dont have any problem, can you please send
> them here ron_michael70 at yahoo.com ?
>
> Thanks and regards,
>
>
>
> statquant wrote:
>
>> HI: I have to go out so I can't say much but I wouldn't jump right to
>> lutkepohl. it's hard to visualize/understanding the matrix case. I would
>> think of the bivariate case and then extend it after undersatanding that.
>> take the simpler bivariate case ( this is taken directly from eric zivot's
>> S+Finmetrics book ). generate y_2t = y_2t-1 + v_t where v_t is normal zero
>> whatever. then let y_1t = b2*y_2t + u_t where u_t is normal zero whatever.
>> This is a cointegrated system with cointegrating vector (1,-b2). you can
>> simulate this to visualize the behavior of y_1 and y_2 over time. If you
>> don't have eric's book, I can fax you the two pages tomorrow. Generally
>> speaking, unless you're quite familar with this material, I would start
>> out with something along the level of Eric's book or Enders and then go to
>> Lutkepohl after that. I really gotta run. Hopefully someone else can help
>> you more but let me know if you want me to fax you the pages. it's 421-428
>> if you have the book. On Jun 28, 2009, RON70
>> <ron_michael70 at yahoo.com> wrote: Thanks Statquant for this reply,
>> however it is still not clear. Suppose I have following theoretical DGP :
>> deltaY[t] = alpha + PI * Y[t-1] + A1 * deltaY[t-1] + A2 * deltaY[t-2] + A3
>> * deltaY[t-3] + epsilon[t] Next suppose, I have chosen some particular
>> matrices as coefficient matrices and taken them as population value.
>> However how can I make it sure that DGP has some unit root, with those
>> arbitrarily chosen coef. matrices? My finding was that, if I chose some
>> arbitrary matrices and then solve the ch. equation, I do not get some
>> solutions as 1 and rests are outside the range [-1, 1]. The steps that I
>> thought of are : 1. Choose some matrices for alpha, PI, A1, A2, A3 (I need
>> to find those!!!) such that ch. equation gives some roots as "1" &
>> rests are outside the range [-1, 1]. 2. Generate 1,000 realizations each
>> with size 100 (say) 3. For each realization, re-estimate the coefficients.
>> 4. Analyze the distribution of the coef. Someone might find it as
>> homework, however it is not. Currently I am studying Lutkepohl and some
>> asymptotic dist. are discussed here. I want to get some empirical match.
>> Any idea? statquant wrote: > > hi ron : the simple vecm is 1) delta
>> y_t = delta x_t + alpha(y_t-1 - > beta*x_t-1) + epsilon_yt ( but check
>> this to make sure ). so, first > generate x_t's that are I(1) by
>> generating x_t = x_t -1 + epsilon_xt Then. > given the x_t's, pick
>> some beta and an an alpha, and generate the y_t's > based on 1). this
>> will give you y_t and x_t that are I(1) and > cointegrated by
>> definition. the multi vecm is more complex but the idea is > the same.
>> On Jun 28, 2009, RON70 &lt; ron_michael70 at yahoo.com &gt; wrote: Hi
>> > all, Can anyone here please help me how to create a DGP which
>> corresponds > to VECM (Vector error correction) ? Actually I want to
>> define a arbitrary > VECM as a DGP and then study the properties of
>> it's realizations. However > I can not construct an arbitrary VECM from
>> my own, especially it's > coefficients, which lead to strictly I(1)
>> process of individual variable. > Thanks and regards, -- View this
>> message in context: >
>> http://www.nabble.com/Creating-a-VCEM-data-generating-process-tp24243230p24243230.html
>> > Sent from the Rmetrics mailing list archive at Nabble.com. >
>> _______________________________________________ >
>> R-SIG-Finance at stat.math.ethz.ch mailing list >
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting
>> > only. -- If you want to post, subscribe first. > > >
>> _______________________________________________ >
>> R-SIG-Finance at stat.math.ethz.ch mailing list >
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance > --
>> Subscriber-posting only. > -- If you want to post, subscribe first.
>> > -- View this message in context:
>> http://www.nabble.com/Re%3A--R-sig-finance--Creating-a-VCEM-data-generating%09process-tp24244254p24245075.html
>> Sent from the Rmetrics mailing list archive at Nabble.com.
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting
>> only. -- If you want to post, subscribe first.
>>
>>
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only.
>> -- If you want to post, subscribe first.
>>
>>
>
>
More information about the R-SIG-Finance
mailing list