[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Date: Sun, 4 Aug 2002 12:50:48 -0500
> 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 "<".
* For searches and help try: