Page 1 of 1

Graph X-axis label and shading

Posted: Mon Jul 29, 2019 10:19 pm
by Max Resende
Dear RATS Users,
I have been trying to graph a time series but for some reason, it doesn't label the x-axis(year) either shades.

have used the following command:

Code: Select all

* Replication file for Chan and Maheu(2002), "Conditional Jump Dynamics
* in Stock Market Returns", JBES, vol 20, no. 3, 377-389.
*
* ARJI model (table 3)
*
source C:\Users\Max\Desktop\Artigos\SBFin_2019\PETROLEO\jumpgarch.src
*
open data C:\Users\Max\Desktop\Artigos\SBFin_2019\PETROLEO\spot_2.txt
data(format=free,org=columns) 1 2262 year month day close logret
cal(julian=%julianfromymd(year,month,day))
*
set r = 100.0*logret
stats r
*
compute start2010=2010:1,end2018=2018:12-1
*
sstats(max) / %if(year(t)<=2018,t,0)>>x2018
sstats(min) / %if(year(t)>=2010,t,1000000)>>x2010
compute end2018=fix(x2018),start2010=fix(x2010)

set crisis = t>=2010:4:10.and.t<=2010:5:10.or.$
             t>=2011:1:10.and.t<=2011:8:1.or.$
             t>=2012:5:1.and.t<=2012:6:30
*
spgraph(hfields=2,footer="Figura 0 ")
graph(shading=crisis,header="(a) Cotações US$/barril",style=lines)
# close
graph(shading=crisis,header="(b) Retornos (%)",style=lines)
# r
spgraph(done)
I have attached the .txt file for better assistance.

Best regards,

Max

Re: Graph X-axis label and shading

Posted: Tue Jul 30, 2019 7:04 am
by TomDoan
You have only 2257 data points, which causes problems with the date mapping.

Note, also that:

compute start2010=2010:1,end2018=2018:12-1
*
sstats(max) / %if(year(t)<=2018,t,0)>>x2018
sstats(min) / %if(year(t)>=2010,t,1000000)>>x2010
compute end2018=fix(x2018),start2010=fix(x2010)

are redundant. The last three lines are the old way of finding that; the first is what works with version 10.

Re: Graph X-axis label and shading

Posted: Tue Jul 30, 2019 8:25 am
by Max Resende
Dear Tom,

I got it!!! Thank you!!

Max