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 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]

Re: st:kdensity (1) at percentile level (2) select bandwidth to compare across two groups


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st:kdensity (1) at percentile level (2) select bandwidth to compare across two groups
Date   Fri, 6 May 2011 12:39:58 -0400

Amanda Fu <mandy.fu1@gmail.com>:
I recommend you start with
. findit akdensity
and read the linked paper
http://www.stata-journal.com/sjpdf.html?articlenum=st0037
for examples.

On Fri, May 6, 2011 at 12:28 PM, Amanda Fu <mandy.fu1@gmail.com> wrote:
> Hi all,
>
> I wonder if someone could help me with two questions related to -kdensity-.
>
> (1) I want to use  -kdensity- to estimate a variable 's kernel density
> at percentile level. If I use
> pctile x_pcile=x, n(100)
> kdensity y, at(x_pctile) g (a1 a2)
>
> I find the variable x_pctile (as well as a1 and a2 ) only has 99 cases
> with values for percentiles. But the left observations all have
> missing values.
> Do I need to create a variable that indicate the percentile value for
> each observation so that each case has a nonmissing value? Is it OK
> just use x_pctile as above?
>
> (2) I want to compare the kernel density curves of a variable for two
> groups. So I need to select a same bandwidth for the estimation for
> the two groups instead of using the optimal default option. But how
> should I choose the bandwidth?

*
*   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