Page 1 of 1

Monte Carlo Simulation with AR(1)-Processes

Posted: Fri Jul 01, 2016 6:02 am
by Klotzi92
Hey all,

my problem is the following one: I want to create a Monte Carlo Simulation with generating two different time series of a AR(1)-Process. Therefore, I generate two independet times series with different white noise processes (different standard deviations). Subsequently, the one lagged values of both times series will be regressed on the endogeneous variable of the first time series. The crucial point is then to find out how many of the 1000 t-statistics of the lagged value from the other time series are significant on the 5%-level.
This is my program code:

Code: Select all

!length = 480 !sample = 400 wfcreate HP u 1 !length !mcmax = 1000 for !phi1 = 0.1 to 1 step 0.1 for !phi2 = 0.1 to 1 step 0.1 !phi110 = 10*!phi1 !phi210 = 10*!phi2 vector(!mcmax) tstat_0!phi110_0!phi210 vector(!mcmax) pwerte_0!phi110_0!phi210 for !i = 1 to !mcmax smpl 1 1 genr y1 = 0 genr y2 = 0 smpl 2 !length genr epsilon = @nrnd*0.0375 genr psi = @nrnd*0.15 genr y1 = !phi1*y1(-1)+epsilon genr y2 = !phi2*y2(-1)+psi smpl !lentgh-!sample+1 !length 'Estimation equation hptest.ls y1 y1(-1) y2(-1) tstat_0!phi110(!i)_0!phi210(!i) = hptest.@tstat(2) pwerte_0!phi110(!i)_0!phi210(!i) = hptest.@pval(2) next next next
Running that, i get the following error message: TSTAT_0!PHI110_01 is an illegal or reserved name in
"VECTOR(1000) TSTAT_0!PHI110_01".

Could you give me an indication why it doesn’t work?
Thank you in advance for your efforts.

Re: Monte Carlo Simulation with AR(1)-Processes

Posted: Fri Jul 01, 2016 8:18 am
by EViews Gareth
Object names cannot have periods in them.

Re: Monte Carlo Simulation with AR(1)-Processes

Posted: Wed Jul 06, 2016 2:12 am
by Klotzi92
Thank you, now it works with this code:

Code: Select all

!length = 480 !sample = 400 wfcreate HP u 1 !length !mcmax = 1000 for !phi1 = 0 to 1 step 0.1 for !phi2 = 0 to 1 step 0.1 !phi110 = 10*!phi1 !phi210 = 10*!phi2 matrix (!mcmax) tstat_0!phi110!phi210 matrix (!mcmax) pwerte_0!phi110!phi210 for !i = 1 to !mcmax 'Beginn der MC-Simulation smpl 1 1 genr y1 = 0 genr y2 = 0 smpl 2 !length genr epsilon = @nrnd*0.0375 genr psi = @nrnd*0.15 y1 = !phi1*y1(-1)+epsilon y2 = !phi2*y2(-1)+psi smpl !length - !sample + 1 !length 'Schätzung equation hptest.ls y1 y1(-1) y2(-1) tstat_0!phi110!phi210(!i) = hptest.@tstat(2) pwerte_0!phi110!phi210(!i) = hptest.@pval(2) next next next
But has anyone an idea, how I could count the significant p-values with a loop?