Question: How To Determine The Location Of A Peak In A List Of Numbers
0
gravatar for litiancheng.gansu
6.1 years ago by
litiancheng.gansu10 wrote:

hello all, I have some numbers, these numbers can be plot and we can found there is a peak, at first this ploted line was increasing, then decreasing, I want to get the peak point among these number, but this line is not absolute increasing and decreasing, there are some small "up" and "drop", it's a sawtooth line. Is there is a R package or perl module would be great helpful to me, could somebody help me?

for example, these number:

1, 2 ,4, 3, 5, 7, 5, 8, 10, 9, 7, 8, 5, 6, 4, 2, 3, 1

I want to get "10".

Add: there are not only one peak, sometimes two or more peak, such as:

1, 2 ,4, 3, 5, 7, 5, 8, 10, 9, 7, 8, 5, 6, 4, 2, 3, 1, 0, 0, 0, 0, 0, 2, 4, 3, 5, 8, 7, 6, 2, 3, 1

I want to get 10 and 8

perl R statistics • 1.5k views
ADD COMMENTlink modified 22 months ago by Biostar ♦♦ 20 • written 6.1 years ago by litiancheng.gansu10
2
gravatar for Istvan Albert
6.1 years ago by
Istvan Albert ♦♦ 78k
University Park, USA
Istvan Albert ♦♦ 78k wrote:

The concept of a "peak" is a lot more complicated than that.

First and foremost it requires a careful definition of what you wish to call a peak - peaks are easy to see by eye while forgetting that our brains have awesome pattern matching capabilities and what we can easily see as a peak may be more difficult to describe in an algorithmic fashion.

What is easy to define is the concept of local maxima: a value that has smaller values on both of its sides. If that fits your purpose then the code is near trivial. More likely however it does not. In that case the simplest approach is to apply a data smoothing process - and then again look for local maxima. Your peak prediction then becomes a choice of data smoothing.

ADD COMMENTlink written 6.1 years ago by Istvan Albert ♦♦ 78k
1
gravatar for Alex Reynolds
6.1 years ago by
Alex Reynolds26k
Seattle, WA USA
Alex Reynolds26k wrote:

Within R:

> v <- c(1, 2 ,4, 3, 5, 7, 5, 8, 10, 9, 7, 8, 5, 6, 4, 2, 3, 1)
> max(v)
[1] 10
ADD COMMENTlink written 6.1 years ago by Alex Reynolds26k

thanks, I found I had described the issue incompletely, there are two or more peaks in my data.

ADD REPLYlink written 6.1 years ago by litiancheng.gansu10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1252 users visited in the last hour