Simulation-Plot

For questions regarding programming in the EViews programming language.

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

Zermelo_I
Posts: 3
Joined: Tue Jun 30, 2015 6:32 am

Simulation-Plot

Postby Zermelo_I » Thu Jul 09, 2015 7:00 am

Dear all,

I am trying to run a simulation, so i would like to generate a sequence of plots in one frame. However, the following code doesn't work, since every plot is created in a new frame.
Is there any chance to get the problem fixed?

Here the code:

Code: Select all

wfcreate test a 1960 2000 scalar r2 = 0 !i=0 while r2 < 0.8 !i=!i+1 series u1 = nrnd series u2 = nrnd series y1 series y2 y1(1) = 0 y2(1) = 0 smpl 1961 @last y1 = y1(-1) + u1 y2 = y2(-1) + u2 smpl @all equation eq.ls y1 c y2 scalar r2 = eq.@r2 graph graph!i y1 y2 graph!i.setupdate(auto) show graph!i delete graph!i wend graph gr1 y1 y2 show gr1 group g1 y1 y2 g1.scat linefit
Thank you very much in advance.

Zermelo_I

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

Re: Simulation-Plot

Postby EViews Gareth » Thu Jul 09, 2015 8:17 am

What exactly do you mean by "in one frame"? You want to create a multi-graph (lots of little graphs all in one picture)? If so, keep all the individual graphs, then at the end merge them into one big graph:

Code: Select all

graph biggraph.merge graph1 graph2 ....

NicolasR
Posts: 90
Joined: Mon Nov 04, 2013 6:22 pm
Location: Here

Re: Simulation-Plot

Postby NicolasR » Thu Jul 09, 2015 8:51 am

Or maybe is something like this:

Code: Select all

wfcreate test a 1960 2000 scalar r2 = 0 while r2 < 0.8 series y1 series y2 y1(1)=0 y2(1)=0 smpl 1961 @last y1 = y1(-1) + nrnd y2 = y2(-1) + nrnd smpl @all equation eq.ls y1 c y2 scalar r2 = eq.@r2 group g y1 y2 g.line y1 y2 wend freeze(gr1) g.line y1 y2 g.scat linefit

Zermelo_I
Posts: 3
Joined: Tue Jun 30, 2015 6:32 am

Re: Simulation-Plot

Postby Zermelo_I » Fri Jul 10, 2015 2:06 am

Hi,

thanks you both for the fast replies.
I am trying to have a sequence of pictures that finally should give the impression of watching a movie. Nicolas code is close already to that, but I in between I see the values of the group which disturb the nice movie. Do you thing it is possible to get rid of that.

Kind regards,
Zermelo_I

NicolasR
Posts: 90
Joined: Mon Nov 04, 2013 6:22 pm
Location: Here

Re: Simulation-Plot

Postby NicolasR » Fri Jul 10, 2015 9:27 am

Question, this is to show that spurious regressions have a high R2?

Code: Select all

wfcreate test a 1960 2000 scalar r2 = 0 series y1=0 series y2=0 group g y1 y2 while r2 < 0.8 smpl 1961 @last y1 = y1(-1) + nrnd y2 = y2(-1) + nrnd smpl @all equation eq.ls y1 c y2 scalar r2 = eq.@r2 g.line y1 y2 wend freeze(gr1) g.line y1 y2 g.scat linefit

Zermelo_I
Posts: 3
Joined: Tue Jun 30, 2015 6:32 am

Re: Simulation-Plot

Postby Zermelo_I » Mon Jul 13, 2015 5:12 am

Dear Nicolas,

yes, you are right, this is the intention of the code. Thanks for your answer!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests