Finding local minima and maxima of a graph

Jonathan Lynch jonathandlynch at gmail.com
Sun Dec 5 00:19:35 EST 2010


Hi Bryan,

The first step is to define a local minimum or maximum for this situation.

Plotting a 3-day rolling average would be pretty straight forward. Is three
days sufficient?

You could get a 5-day rolling average, then pick five day averages that are
are greater than, or less than, their neighboring 5-day averages. You would
not do this by comparing successive discreet 5-day periods, though. Instead,
each 5-day period needs to overlap its neighbors by 4 days - does that make
sense?

Also, consider this. You could just look for peaks and valleys that are
greater or less than all neighbors within 5 days, or within 10 days. Only
the standout data points would show up in that circumstance.

I would be wary of trying to approximate your data set with a simple
formula, like a sine wave. If you can come up with a good fit, then maybe -
but don't settle for a rough fit.





On Sat, Dec 4, 2010 at 11:32 PM, Bryan McCormick <bryan at deepfoo.com> wrote:

> Jerry,
>
> Yes, that would be far too many hits and there has to be some scaling
> applied as a filter for that reason. The criteria more precisely is
> "significant" peak and trough values. With significant being the trick. For
> example, is the peak or trough 3 percent or more away.
>
> There is a seasonal and/or trend component to the data. So I think step one
> has to be detrending the series first. If you happen to have a good notion
> of how to write a least-squares fit that would be a great. I'll then be able
> to isolate the peaks and troughs by differencing from that line.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Do all things with love



More information about the use-livecode mailing list