Find extrema of a distribution
find_extrema_density.Rd
Find values corresponding to extrema of a distribution (numeric vector). First, the function establishes the density of the input numeric vector. Then, it estimates the first derivate. Then, it identifies extrema thanks to the sign changes in derivates. If you want all extrema, minima or maxima, it outputs values.
Arguments
- val
NUMERIC : a numeric vector
- n
NUMERIC : a power of 2 to compute the density of val. Low values will decrease confidency in results. High values makes the analysis time consuming (default to 2^10)
- what
CHARACTER : one of "minima", "maxima" or "both", to output what you want. If you specify something else, it will returns both minima and maxima (default to "minima")