[R] Finding local minima and maxima
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed Jun 15 14:16:03 CEST 2005
Sean Davis wrote:
> I have data in the form of (x,y) pairs and would like to find local
> minima and maxima (typically the zeros of the 2nd derivative) of the y
> values. I looked at numericDeriv, but I don't have an "expression" per
> se. I looked at optim, also, but it looks like it will find only one
> "global" max or min. I can code up my own piecewise derivatives, but
> wondered if there is an existing function to do this.
If you don't have derivatives, and you don't have an expression, and you
don't have a criteria how to minimize, please tell me of any known
method that can handle your problem well enough.
You could look whether y[i-1] <y[i] and y[i+1]<y[i] if y is ordered
according to x, if this most trivial and very non-robust method fits to
your definition...
Uwe Ligges
> Thanks,
> Sean
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list