Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: plotting time series |

Date |
Sun, 3 Jun 2012 09:26:05 +0100 |

You are plotting your Austria and Belgium values at 9 and 10 and asking for axis labels at 1 and 2. As you say, the result looks bizarre. Use the same positions for axis labels. Also, "Austria" and "Belgium" are not best labelled as "Italy" and "France". In short, you copied code but did not change it for your purposes. Nick On Sun, Jun 3, 2012 at 4:08 AM, stef salvez <loggyedy@googlemail.com> wrote: > Nick, > > I replicated your approach for my case. > > So I have > > > clear all > input str8 (Austria Belgium ) > "2/11/08" "07/12/08" > "30/11/08" "04/01/08" > "28/12/08" "01/02/09" > "25/01/09" "01/03/09" > "22/02/09" "29/03/09" > "22/03/09" "26/04/09" > "19/04/09" "24/05/09" > "17/05/09" "21/06/09" > "14/06/09" "19/07/09" > "12/07/09" "16/08/09" > "09/08/09" "13/09/09" > "06/09/09" "11/10/09" > "04/10/09" "08/11/09" > "01/11/09" "06/12/09" > "29/11/09" "03/01/10" > "27/12/09" "31/01/10" > "31/01/10" "28/02/10" > "28/02/10" "28/03/10" > "28/03/10" "25/04/10" > "25/04/10" "23/05/10" > "23/05/10" "20/06/10" > "20/06/10" "18/07/10" > "18/07/10" "15/08/10" > "15/08/10" "12/09/10" > "12/09/10" "10/10/10" > "10/10/10" "07/11/10" > "07/11/10" "05/12/10" > "01/01/10" "30/01/11" > "30/01/11" "27/02/11" > "27/02/11" "27/03/11" > "27/03/11" "24/04/11" > "24/04/11" "22/05/11" > "22/05/11" "19/06/11" > "19/06/11" "17/07/11" > "17/07/11" "14/08/11" > "14/08/11" "11/09/11" > "11/09/11" "09/10/11" > "09/10/11" "06/11/11" > end > gen dAustria = date(Austria, "DM20Y") > gen dBelgium = date(Belgium, "DM20Y") > > gen dA2 = dAustria - dAustria[_n-1] > gen dB2 = dBelgium - dBelgium[_n-1] > > gen t10 = (dA2 + dA2[_n-1]) / 2 > gen t9 = (dB2 + dB2[_n-1]) / 2 > > > gen ten = 10 > gen nine = 9 > > scatter ten dAustria|| scatter nine dBelgium || /// > scatter ten t10, ms(none) mla(dA2) mlabpos(12) || /// > scatter nine t9 , ms(none) mla(dB2) mlabpos(12) /// > > yla(1 "Italy" 2 "France", ang(h)) xla(, format(%td)) legend(off) > > The problem seems to be in > > > scatter ten t10, ms(none) mla(dA2) mlabpos(12) || /// > scatter nine t9 , ms(none) mla(dB2) mlabpos(12) /// > > where I obtain something bizarre. Maybe this has to do with the scale > of the diagram. > > How could I correct it? > > Thanks > > > > > > On 6/2/12, stef salvez <loggyedy@googlemail.com> wrote: >> Thank you Nick. Now it's fine. cheers >> >> On 6/2/12, Nick Cox <njcoxstata@gmail.com> wrote: >>> There is no problem with your Stata. >>> >>> /// is not / / / >>> >>> Nick >>> >>> On Sat, Jun 2, 2012 at 8:22 PM, stef salvez <loggyedy@googlemail.com> >>> wrote: >>>> Nick, >>>> >>>> I omitted the /// because if I type >>>> >>>> scatter two dFrance || scatter one dItaly || /// >>>> >>>> look what stata tells me >>>> >>>> / / / is not a twoway plot type >>>> r(198); >>>> >>>> Is there any problem with my stata software? >>>> >>>> >>>> On 6/2/12, Nick Cox <njcoxstata@gmail.com> wrote: >>>>> That's not a command. You omitted the /// which signal that the next >>>>> line is a continuation. Look again at >>>>> >>>>> 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 7:43 PM, stef salvez <loggyedy@googlemail.com> >>>>> wrote: >>>>>> 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 <njcoxstata@gmail.com> 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 <njcoxstata@gmail.com> >>>>>>> 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 >>>>>>>> <loggyedy@googlemail.com> >>>>>>>> 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 <n.j.cox@durham.ac.uk> wrote: >>>>>>>>>> Have a look at -stripplot- from SSC. >>>>>>>>>> >>>>>>>>>> Nick >>>>>>>>>> n.j.cox@durham.ac.uk >>>>>>>>>> >>>>>>>>>> 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/ >>>>> >>>>> * >>>>> * 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/ >>> >>> * >>> * 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/ * * 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/

**References**:**st: plotting time series***From:*stef salvez <loggyedy@googlemail.com>

**st: RE: plotting time series***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: RE: plotting time series***From:*stef salvez <loggyedy@googlemail.com>

**Re: st: RE: plotting time series***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: RE: plotting time series***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: RE: plotting time series***From:*stef salvez <loggyedy@googlemail.com>

**Re: st: RE: plotting time series***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: RE: plotting time series***From:*stef salvez <loggyedy@googlemail.com>

**Re: st: RE: plotting time series***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: RE: plotting time series***From:*stef salvez <loggyedy@googlemail.com>

**Re: st: RE: plotting time series***From:*stef salvez <loggyedy@googlemail.com>

- Prev by Date:
**Re: st: Question about comparing two datasets in Stata** - Next by Date:
**st: AW: Calculating dynamic confidence intervals after ARIMA** - Previous by thread:
**Re: st: RE: plotting time series** - Next by thread:
**st: Age-specific reference intervals (xrigls) - no equation for SD?** - Index(es):