simulation

Questions and discussions on Vector Autoregressions

simulation

Postby iloverats » Tue Apr 12, 2011 1:48 am

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
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Re: simulation

Postby TomDoan » Tue Apr 12, 2011 9:21 am

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.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: simulation

Postby iloverats » Tue Apr 12, 2011 11:16 am

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
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Re: simulation

Postby TomDoan » Tue Apr 12, 2011 3:11 pm

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.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: simulation

Postby iloverats » Sat Oct 01, 2011 7:29 am

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.
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Re: simulation

Postby TomDoan » Sat Oct 01, 2011 8:17 am

The CV option on GROUP is the covariance matrix of the residuals. Make it what you want instead of the identity.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: simulation

Postby iloverats » Thu Oct 06, 2011 3:55 am

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
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Re: simulation

Postby TomDoan » Thu Oct 06, 2011 8:11 am

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.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: simulation

Postby iloverats » Thu Oct 06, 2011 7:34 pm

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
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Re: simulation

Postby TomDoan » Fri Oct 07, 2011 9:22 am

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.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: simulation

Postby iloverats » Fri Oct 07, 2011 11:21 am

Dear sir

May you tell me how can i simulate the series that is AR(2) process and contain the unit root and AR(2) process with a maximum root 0.9
thank you :!:
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Re: simulation

Postby TomDoan » Fri Oct 07, 2011 1:44 pm

iloverats wrote:Dear sir

May you tell me how can i simulate the series that is AR(2) process and contain the unit root and AR(2) process with a maximum root 0.9
thank you :!:


No, because neither one of those is a well-defined DGP---you can't give just one root for an AR(2). Write down a full DGP with the properties that you want and convert it to a VAR by substituting out any differences that you used. Once you have that, just replace the definition for the two equations above.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: simulation

Postby iloverats » Fri Oct 07, 2011 8:47 pm

TomDoan wrote:
iloverats wrote:Dear sir

May you tell me how can i simulate the series that is AR(2) process and contain the unit root and AR(2) process with a maximum root 0.9
thank you :!:


No, because neither one of those is a well-defined DGP---you can't give just one root for an AR(2). Write down a full DGP with the properties that you want and convert it to a VAR by substituting out any differences that you used. Once you have that, just replace the definition for the two equations above.


Dear
I just want simulate the AR(2) model that contains the unit root or has a maximum root 0.9, rather than VAR

may you help me?
thank you very much
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Re: simulation

Postby TomDoan » Sat Oct 08, 2011 11:02 am

iloverats wrote:Dear
I just want simulate the AR(2) model that contains the unit root or has a maximum root 0.9, rather than VAR

may you help me?
thank you very much


Yes, I will help you by making two suggestions.

1. Get a book on time series.
2. READ IT.

You don't understand what you're trying to do well enough to even ask a well-formed question.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: simulation

Postby iloverats » Sun Nov 27, 2011 11:36 am

TomDoan wrote:
iloverats wrote:Dear
I just want simulate the AR(2) model that contains the unit root or has a maximum root 0.9, rather than VAR

may you help me?
thank you very much


Yes, I will help you by making two suggestions.

1. Get a book on time series.
2. READ IT.

You don't understand what you're trying to do well enough to even ask a well-formed question.

i still do not know how to do it :roll:
iloverats
 
Posts: 45
Joined: Thu Dec 02, 2010 11:32 am

Next

Return to VARs (Vector Autoregression Models)

Who is online

Users browsing this forum: Google [Bot] and 1 guest