Re: Time Series Data in Quarters
- To: mathgroup at smc.vnet.net
- Subject: [mg112216] Re: Time Series Data in Quarters
- From: "Hans Michel" <hmichel at cox.net>
- Date: Sun, 5 Sep 2010 05:27:06 -0400 (EDT)
Jroge:
Try
In[1]:= data = {{{"2007, Q1"}, 10},{{"2007, Q2"}, 20},{{"2007, Q3"},
30},{{"2007, Q4"}, 40}}
Out[1]= {{{2007, Q1},10},{{2007, Q2},20},{{2007, Q3},30},{{2007, Q4},40}}
In[2]:= DateListPlot[data, DateFunction :>
(DateList[ToString[StringReplace[#,{"Q1" -> "03, 01", "Q2" -> "06, 01","Q3"
-> "09, 01","Q4" -> "12, 01"}]]] &), DateTicksFormat->{"Year", " ",
"QuarterNameShort"}]
"Quarter", "QuarterName", and "QuarterNameShort" are geared towards output
regrettably not for datetime parsing to Date.
You may wish to choose different Month and Day for the replacement rules for
Q1, Q2, Q3, and Q4. More like the middle date of each quarter or the first
day of each quarter.
Fiscal year is different for government and companies.
1st Quarter: October 1, 2009 - December 31, 2009
2nd Quarter: January 1, 2010 - March 31, 2010
3rd Quarter: April 1, 2010 - June 30, 2010
4th Quarter: July 1, 2010 - September 30, 2010
Whereas calendar year quarters
1st Quarter: January 1, 2010 - March 31, 2010
2nd Quarter: April 1, 2010 - June 30, 2010
3rd Quarter: July 1, 2010 - September 30, 2010
4th Quarter: October 1, 2010 - December 31, 2010
Hans.
-----Original Message-----
From: jroge [mailto:phantomwhatnot at gmail.com]
Sent: Friday, September 03, 2010 5:09 AM
To: mathgroup at smc.vnet.net
Subject: [mg112216] [mg112167] Time Series Data in Quarters
I just received some financial data that I would like to analyze,
however the data is by fiscal quarter. DateListPlot seems to require
specific dates for plotting, rather than an option that is more
abstract such as Q1, 2007. Any suggestions?