Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: how to draw several kdensity curves in one graph


From   "G. Dai" <dgecon@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: how to draw several kdensity curves in one graph
Date   Tue, 2 Mar 2010 14:21:46 -0800

thanks, Chris and Martin. It works well. Guang

On Tue, Mar 2, 2010 at 1:56 PM, Martin Weiss <martin.weiss1@gmx.de> wrote:

>
> <>
>
> " Possibly this is the command you would want to use
> for more recent versions of Stata, but I am not sure."
>
>
>
>
> Nope, yours still works fine, even though the -twoway- version would
> probably be preferred these days. Stata 11 processes this w/o complaining:
>
>
> *******
>
> clear*
> set obs 5
> gen byte year=_n
> expand 1000
> gen var=rchi2(5)+year
> kdensity var if (year==1), plot(kdensity var if ///
> (year==2)||kdensity var if (year==3)) legend(ring(0) pos(2) ///
> label(1 "1999") label(2 "1989") label(3 "1979") )
> *******
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Christopher
> Hajzler
> Sent: Dienstag, 2. März 2010 22:53
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: how to draw several kdensity curves in one graph
>
> I should have mentioned one more thing: I use an older version of
> Stata (Stata 8), but when I was researching commands, some
> instructions mentioned "addplot" instead of just plot, but this did
> not work for me.  Possibly this is the command you would want to use
> for more recent versions of Stata, but I am not sure.
>
> On Wed, Mar 3, 2010 at 10:49 AM, Christopher Hajzler <chajzler@gmail.com>
> wrote:
> > Hi Guang,
> >
> > Coincidentally, I was just wrestling with the same thing myself
> > yesterday.  Here is the command I used:
> >
> > kdensity var if (year==1999), plot(kdensity var if
> > (year==1989)||kdensity var if (year==1979)) legend(ring(0) pos(2)
> > label(1 "1999") label(2 "1989") label(3 "1979") )
> >
> > Hope this helps!
> >
> > Chris
> >
> > On Wed, Mar 3, 2010 at 10:48 AM, Christopher Hajzler <chajzler@gmail.com
> >
> wrote:
> >>
> >> Hi Guang,
> >>
> >> Coincidentally, I was just wrestling with the same thing myself
> yesterday.  Here is the command I used:
> >>
> >> kdensity var if (year==1999), plot(kdensity var if
> (year==1989)||kdensity
> var if (year==1979)) legend(ring(0) pos(2) label(1 "1999") label(2 "1989")
> label(3 "1979") )
> >>
> >> Hope this helps!
> >>
> >> Chris
> >>
> >> On Wed, Mar 3, 2010 at 10:04 AM, G. Dai <dgecon@gmail.com> wrote:
> >>>
> >>> dear all,
> >>> I have income observation from several different years. For each year,
> I
> >>> can
> >>> easily draw a density curve by using kdensity. however, I'd like to
> have
> the
> >>> distribution
> >>> curves for different years on the same graph. how can I achieve that?
> >>> regards,
> >>> Guang
> >>>
> >>> *
> >>> *   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index