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]

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


From   Amanda Fu <mandy.fu1@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st:kdensity (1) at percentile level (2) select bandwidth to compare across two groups
Date   Fri, 6 May 2011 12:28:08 -0400

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?


Thank you!

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