Page 1 of 1

Simulation-Plot

Posted: Thu Jul 09, 2015 7:00 am
by Zermelo_I
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

Re: Simulation-Plot

Posted: Thu Jul 09, 2015 8:17 am
by EViews Gareth
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 ....

Re: Simulation-Plot

Posted: Thu Jul 09, 2015 8:51 am
by NicolasR
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

Re: Simulation-Plot

Posted: Fri Jul 10, 2015 2:06 am
by Zermelo_I
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

Re: Simulation-Plot

Posted: Fri Jul 10, 2015 9:27 am
by NicolasR
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

Re: Simulation-Plot

Posted: Mon Jul 13, 2015 5:12 am
by Zermelo_I
Dear Nicolas,

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