Bookmark and Share

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]

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


From   Amanda Fu <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index