Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: kernel density


From   "Ben Jann" <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: kernel density
Date   Thu, 18 Sep 2008 09:50:55 +0200

I think a better approach would be

 twoway (kdensity weight if foreign==1) (kdensity weight if foreign==0)

or

 twoway kdensity weight if foreign==1 || kdensity weight if foreign==0

because this allows you to display the curves for more than two groups, e.g.

 twoway kdensity weight if rep==3 || kdensity weight if rep==4 ||
kdensity weight if rep==5

ben

On Thu, Sep 18, 2008 at 9:03 AM, Svend Juul <SJ@soci.au.dk> wrote:
>
> Nigussie wrote:
>
> I am PhD student and request your assistance on this issues.  Suppose I
> have two columns variable "lnexp" and "region" where lnexp is log of
> expenditure (continuous) and region is a categorivsl variable; 1=Eastern
> region, 2=Southern region and 3= Northern region. If I want to draw
> kernel graphs of "lnexp" for these regions on one chart,  what should I
> do on Stata 10? I need a command.
>
> ===============================================================
>
> You can use the addplot() option, like this:
>
>   sysuse auto.dta , clear
>   kdensity weight if foreign==1 , addplot(kdensity weight if
> foreign==0)
>
> Hope this helps
> Svend
> __________________________________________
>
> Svend Juul
> Institut for Folkesundhed, Afdeling for Epidemiologi
> (Institute of Public Health, Department of Epidemiology)
> Vennelyst Boulevard 6
> DK-8000  Aarhus C, Denmark
> Phone:  +45 8942 6090
> Home:   +45 8693 7796
> Email:  sj@soci.au.dk
> __________________________________________
>
> *
> *   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   |   What's new   |   Site index