simulation

Questions and discussions on Vector Autoregressions
iloverats
Posts: 39
Joined: Thu Dec 02, 2010 10:32 am

simulation

Unread post by iloverats »

dear all
how can i generate a series x,which is the granger causality of y? :?:
for example

x=a*x{1}+b*y{1}+et
:D
best
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: simulation

Unread post by TomDoan »

iloverats wrote:dear all
how can i generate a series x,which is the granger causality of y? :?:
for example

x=a*x{1}+b*y{1}+et
:D
best
Something like this. You need a DGP for y as well, which is here an autoregression.

Code: Select all

all 120
set x = 0.0
set y = 0.0
frml xf x = .6*x{1}+.2*y{1}
frml yf y = .0*x{1}+.8*y{1}
group(cv=%identity(2)) twovar xf>>x yf>>y
simulate(model=twovar,from=2,to=120)
Typically, you would discard a certain number of early data points since the pre-sample zeros aren't representative of the process---this generates through 120 so that you can use 21-120 as 100 data points.
iloverats
Posts: 39
Joined: Thu Dec 02, 2010 10:32 am

Re: simulation

Unread post by iloverats »

TomDoan wrote:
iloverats wrote:dear all
how can i generate a series x,which is the granger causality of y? :?:
for example

x=a*x{1}+b*y{1}+et
:D
best
Something like this. You need a DGP for y as well, which is here an autoregression.

Code: Select all

all 120
set x = 0.0
set y = 0.0
frml xf x = .6*x{1}+.2*y{1}
frml yf y = .0*x{1}+.8*y{1}
group(cv=%identity(2)) twovar xf>>x yf>>y
simulate(model=twovar,from=2,to=120)
Typically, you would discard a certain number of early data points since the pre-sample zeros aren't representative of the process---this generates through 120 so that you can use 21-120 as 100 data points.
thank you
if i want x and y all have Garch(1,1) effect
how can i modify the code
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: simulation

Unread post by TomDoan »

iloverats wrote:thank you
if i want x and y all have Garch(1,1) effect
how can i modify the code
I've posted code for generating an MV-GARCH process at

http://www.estima.com/forum/viewtopic.php?f=11&t=1024

That would be the error process, so you would need to use FORECAST with the PATHS option, instead of SIMULATE, for putting together your mean model with simulated GARCH errors.
iloverats
Posts: 39
Joined: Thu Dec 02, 2010 10:32 am

Re: simulation

Unread post by iloverats »

all 120
set x = 0.0
set y = 0.0
frml xf x = .6*x{1}+.2*y{1}
frml yf y = .0*x{1}+.8*y{1}
group(cv=%identity(2)) twovar xf>>x yf>>y
simulate(model=twovar,from=2,to=120)

the code have no residual Contemporaneou-correlations
if i want residuals are cross Contemporaneou correlated,and the correlation coefficient is 0.8
how can i modify the code :?: :D
Last edited by iloverats on Sat Oct 01, 2011 8:55 am, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: simulation

Unread post by TomDoan »

The CV option on GROUP is the covariance matrix of the residuals. Make it what you want instead of the identity.
iloverats
Posts: 39
Joined: Thu Dec 02, 2010 10:32 am

Re: simulation

Unread post by iloverats »

TomDoan wrote:The CV option on GROUP is the covariance matrix of the residuals. Make it what you want instead of the identity.
Dear
If i want y and x are all nonstationary , how can i set it?

thank you very much
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: simulation

Unread post by TomDoan »

The covariance matrix has nothing to do with non-stationarity. You need to pick a set of lag coefficients which will do that. Write down a model in VECM form and solve it out for the original variables.
iloverats
Posts: 39
Joined: Thu Dec 02, 2010 10:32 am

Re: simulation

Unread post by iloverats »

TomDoan wrote:The covariance matrix has nothing to do with non-stationarity. You need to pick a set of lag coefficients which will do that. Write down a model in VECM form and solve it out for the original variables.
Dear
May you give me an example?
thank you
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: simulation

Unread post by TomDoan »

Engle and Granger(1987) in "Co-Integration and Error Correction", Econometrica, vol 55, no 2 give about six examples of DGP's for non-stationary VAR's.
Post Reply