Monte Carlo Simulation with AR(1)-Processes

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Klotzi92
Posts: 2
Joined: Fri Jul 01, 2016 5:34 am

Monte Carlo Simulation with AR(1)-Processes

Postby Klotzi92 » Fri Jul 01, 2016 6:02 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Fri Jul 01, 2016 8:18 am

Object names cannot have periods in them.

Klotzi92
Posts: 2
Joined: Fri Jul 01, 2016 5:34 am

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

Postby Klotzi92 » Wed Jul 06, 2016 2:12 am

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?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests