Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: plotting time series


From   stef salvez <[email protected]>
To   [email protected]
Subject   Re: st: RE: plotting time series
Date   Sat, 2 Jun 2012 19:43:37 +0100

Nick thank you very much indeed.

In Stata the command

yla(1 "Italy" 2 "France", ang(h)) xla(, format(%td)) legend(off)

does not work as I get the warning message

unrecognized command:  yla
r(199);

Similarly for xla. I am so close to getting the desired plot!.Please help!!!!




On 6/2/12, Nick Cox <[email protected]> wrote:
> On a second reading I think I understood better. This may help:
>
> clear
> input str8 (France              Italy)
> "22/02/09"        "14/06/09
> "22/03/09"       "12/7/09
> "19/04/09"        "9/8/09
> "17/05/09"                "6/9/09"
> "12/7/09"       "4/10/09"
> "09/08/09"        "01/11/09"
> "6/9/09"         "29/11/09"
> "4/10/09"       "27/12/09"
> "01/11/09"       "31/01/10"
> "29/11/09"        "28/02/10"
> "27/12/09"        "28/03/10"
> "31/01/10"        "1/5/10"
> end
> gen dFrance = date(France, "DM20Y")
> gen dItaly = date(Italy, "DM20Y")
> gen dF2 = dFrance - dFrance[_n-1]
> gen dI2 = dItaly - dItaly[_n-1]
> gen t2 = (dFr + dFr[_n-1]) / 2
> gen t1 = (dIt + dIt[_n-1]) / 2
> gen two = 2
> gen one = 1
> scatter two dFrance || scatter one dItaly || ///
> scatter two t2, ms(none) mla(dF2) mlabpos(12) || ///
> scatter one t1 , ms(none) mla(dI2) mlabpos(12) ///
> yla(1 "Italy" 2 "France", ang(h)) xla(, format(%td)) legend(off)
>
>
> On Sat, Jun 2, 2012 at 5:56 PM, Nick Cox <[email protected]> wrote:
>> Sorry, I don't think I have a good understanding of what you want
>> here. In any case, adding lines can't add to information on spacing
>> that is not already shown on the graph.
>>
>> Nick
>>
>> On Sat, Jun 2, 2012 at 5:42 PM, stef salvez <[email protected]>
>> wrote:
>>> thank you NIck. It worked
>>>
>>> Let me explained what I did in order to tell you what I eventually need
>>>
>>> The MS excel file is the following
>>>
>>> have these sequence of dates in an excel file. The structure of the
>>> excel file is
>>> France              Italy                        ......
>>> 22/02/09               14/06/09
>>>  22/03/09       12/7/2009
>>> 19/04/09        9/8/2009
>>> 17/05/09                6/9/2009
>>> 12/7/2009       4/10/2009
>>>  09/08/09        01/11/09
>>> 6/9/2009                29/11/09
>>> 4/10/2009       27/12/09
>>>  01/11/09       31/01/10
>>> 29/11/09              28/02/10
>>> 27/12/09              28/03/10
>>> 31/01/10
>>>
>>>
>>>  The I apply the commands
>>>
>>> clear
>>> set trace off
>>> set more off
>>> set mem 120m
>>> cd d:\
>>> insheet using "dates0.csv"
>>> gen edate1 = date(v1, "DMY")
>>> gen edate2 = date(v2, "DMY")
>>>
>>> format edate1  %
>>> format edate2  %
>>> stripplot edate1 edate2
>>>
>>> and I get the desired plot. Yet the problem is that I also want to add
>>> on the top of each of these 2 lines the distance ( measured in days)
>>> between these successive dates for each country.  And mark each
>>> distance with a symbol like { or [. Is is possible to extend the
>>> stripplot command somehow to achieve the desired resuls?
>>> thanks again
>>>
>>>
>>>  Is it possible to add on the top of each of these 2 lines the
>>> distance ( measured in days) between these successive dates for each
>>> country. I would be grateful to you if you could also mark each
>>> distance with a symbol like { or [. I know it is a big challenge to
>>> you but for me is an impossible task
>>>
>>> thanks again
>>>
>>>
>>>
>>>
>>> On 6/1/12, Nick Cox <[email protected]> wrote:
>>>> Have a look at -stripplot- from SSC.
>>>>
>>>> Nick
>>>> [email protected]
>>>>
>>>> stef salvez
>>>>
>>>> I have a panel data across countries and individuals. For each country
>>>>  I have a sequence of dates
>>>> For France for example
>>>> 22/02/09
>>>> 22/03/09
>>>> 19/04/09
>>>> 17/05/09
>>>> 12/07/09
>>>> 09/08/09
>>>> 06/09/09
>>>> 04/10/09
>>>> 01/11/09
>>>> 29/11/09
>>>> 27/12/09
>>>> 31/01/10
>>>>
>>>> For Italy
>>>> 14/06/09
>>>> 12/07/09
>>>> 09/08/09
>>>> 06/09/09
>>>> 04/10/09
>>>> 01/11/09
>>>> 29/11/09
>>>> 27/12/09
>>>> 31/01/10
>>>> 28/02/10
>>>> 28/03/10
>>>>
>>>> And I want to "plot" (in one graph) these sequences of dates in the
>>>> sense that I want to have a"visual" contact of each of the behaviour
>>>> of  the series of dates because as you can see I do not have the same
>>>> start date and   end date and the next date is not always every 28
>>>> days. So I have a jump in some cases. I would like to visualize these
>>>> characteristics-differences between the two  series of  dates by
>>>> making a plot.
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index