Page 1 of 1
Line and 5year Max/Min range on the same seasonal graph
Posted: Wed Sep 02, 2015 3:53 am
by eviewsuserforum
Hi everyone
I want a to draw a seasonal chart (monthly data, x-axis on from Jan to Dec), showing a line for the data of the current year and the 5-year max-min range .
See the pic:
http://imgur.com/Tyhf8m9
I first start by slicing my sample, restricting it to 2015
I then draw the line for 2015, creating line chart named myChart from my series named myData :
Now, how can I compute the min and max value for each month (Jan to Dec) from 2010 to 2014? Then how do I add this range (my understanding is that is is a band graph in Eviews) to my chart?
Thank you
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Wed Sep 02, 2015 10:00 am
by EViews Gareth
Something like this:
Code: Select all
create m 2010 2015
series mydata = rnd*140
series monthmaxes = @maxsby(mydata, @month, "2010 2014")
series monthmins = @minsby(mydata, @month, "2010 2014")
group g monthmaxes monthmins mydata
show g.mixed band(1,2) line(3)
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Fri Sep 04, 2015 1:12 am
by eviewsuserforum
Thank you for your reply.
Unfortunately, Eviews doesn't seem to like line and band chart types on the same graph (I have had such problems while trying out myself before I leave a question in this forum).
Code: Select all
MIXED is not a valid view for G in "SHOW G.MIXED BAND(1,2) LINE(3)"
How can I force Eviews to plot a line and bands on the same graph, please?
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Fri Sep 04, 2015 6:36 am
by EViews Gareth
Which version?
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Tue Sep 08, 2015 5:23 am
by eviewsuserforum
Hello. Sorry for the late reply.
I am using Eviews 8, Standard Edition - May 6 2013 build.
Thank you.
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Wed Sep 09, 2015 9:29 am
by EViews Jason
The 'mixed' command is a new EViews 9 feature
If you are only going to have 1 band and 1 line, then in 8 you could use.
Code: Select all
create m 2010 2015
series mydata = rnd*140
series monthmaxes = @maxsby(mydata, @month, "2010 2014")
series monthmins = @minsby(mydata, @month, "2010 2014")
group g monthmaxes monthmins mydata
show g.band
If you add anymore more series to your group 'mixed' will provide a lot more flexibility. In this simple case, 'band' should suffice.
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Thu Sep 10, 2015 1:23 am
by eviewsuserforum
Thank you Jason.
Gloups, I actually want to plot the 5-year range, a line for the current year, and a line for the previous year and the line (forecast) for the ea to come.
Thanks.
EDIT: I finally did something along what follows:
Code: Select all
create m 2010 2015
series mydata = rnd*100
series mydata2 = rnd*100
series monthmaxes = @maxsby(mydata, @month, "2010 2014")
series monthmins = @minsby(mydata, @month, "2010 2014")
group g monthmaxes monthmins mydata mydata mydata2 mydata2
' One can 'control' lines size like this
' group g monthmaxes monthmins mydata mydata*0.995 mydata2 mydata2*0.995
show g.band
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Fri Sep 11, 2015 2:06 pm
by EViews Jason
Clever. So you basically added 3 bands where 2 of the bands are very small, such that they appear to be lines.
For future reference in EViews 9, you could use
Code: Select all
group g monthmaxes monthmins mydata mydata2
show g.mixed band(1,2) line(3,4)
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Mon Sep 14, 2015 4:50 am
by eviewsuserforum
Say I want to use the code showed the other:
Code: Select all
create m 2010 2015
series mydata = rnd*100
series mydata2 = rnd*100
series monthmaxes = @maxsby(mydata, @month, "2010 2014")
series monthmins = @minsby(mydata, @month, "2010 2014")
group g monthmaxes monthmins mydata mydata mydata2 mydata2
' One can 'control' lines size like this
' group g monthmaxes monthmins mydata mydata*0.995 mydata2 mydata2*0.995
show g.band
How can I control the name of the series, eg how do I set the name of the range ("monthmaxes monthmins") to the string "5-year range"?
And what is the equivalent for a group object of .setupdate(a) that I usually use for graph objects?
Thank you.
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Mon Sep 14, 2015 8:53 am
by EViews Jason
Try:
Code: Select all
create m 2010 2015
series mydata = rnd*100
series mydata2 = rnd*100
series monthmaxes = @maxsby(mydata, @month, "2010 2014")
series monthmins = @minsby(mydata, @month, "2010 2014")
group g monthmaxes monthmins mydata mydata mydata2 mydata2
' One can 'control' lines size like this
' group g monthmaxes monthmins mydata mydata*0.995 mydata2 mydata2*0.995
freeze(mygraph) g.band
show mygraph
mygraph.setelem(1) legend("5-year range")
mygraph.setelem(2) legend("")
There isn't an equivalent for a group object of .setupdate(a), since group objects are always updated (i.e. they always are set to auto). But with my above example, you may want
Re: Line and 5year Max/Min range on the same seasonal graph
Posted: Tue Sep 15, 2015 1:13 am
by eviewsuserforum
Hello Jason. Thank you!