Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Date: Sun, 4 Aug 2002 12:50:48 -0500


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Date: Sun, 4 Aug 2002 12:50:48 -0500
Date   Mon, 5 Aug 2002 11:40:53 +0100

Sangeeta Goyal
> 
> I need to bootstrap kernel density estimates for a single 
> variable and
> calculate and save their first and second derivatives in 
> order to count the
> number of turning points. Any help will be welcome.
> 

Working backwards, if the primary interest 
is in # of turning points, then you don't 
need first and second derivatives. A naive but 
direct approach should suffice. 

A minimum is less than its neighbours and
a maximum is more than its neighbours, 
so (e.g. for minima) a first stab would be, given 
the correct sort order 

count if density < density[_n-1] & density < density[_n+1] 

The first wrinkle is to make sure you omit 
boundary points, as no point precedes the first
or follows the last. 

A second wrinkle might be to worry about equality 
with neighbours, i.e. check "<=" as well as "<". 

Nick 
[email protected] 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index