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:kdensity (1) at percentile level (2) select bandwidth to compare across two groups
From
Austin Nichols <[email protected]>
To
[email protected]
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 <[email protected]>:
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 <[email protected]> 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/