Re: grouping similar list elements with gaps
- To: mathgroup at smc.vnet.net
- Subject: [mg73477] Re: [mg73468] grouping similar list elements with gaps
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Mon, 19 Feb 2007 01:27:38 -0500 (EST)
- References: <200702181113.GAA13453@smc.vnet.net>
how "far above or below" the threshold are you willing to go? On 2/18/07, Stern <nycstern at gmail.com> wrote: > I work with time series data of the form > {{timecode1,datum1},{timecode2,datum2},...}. The timecodes can be in > any of several formats, but for internal calculations I convert them > to "Mathematica integer" format, which is to say, the absolute number > of seconds since the beginning of January 1, 1900. > > My current interest involves continuous runs of dates above or below a > defined threshold. This is relatively easy, using the Split and Select > commands. For example, > > Select[Split[TIMESERIESLIST, Sign[#1[[2]] - THRESHOLD] == > Sign[#2[[2]] - THRESHOLD] &], (Min[Transpose[#][[2]]] =98 THRESHOLD) &] > > (Thanks to Bob Hanlon, for suggesting this basic approach). > > I would like to generalize this to handle cases where there are small > gaps in the pattern. So, for example, if I am willing to tolerate a > gap of 3, then if list members 3-100 are above the threshold and list > members 102-200 are above the threshold, then the entire period 3-200 > is marked as above, though time unit 101 would, on its own, fail. > > This may need to be handled recursively, as combined periods above the > threshold may fall close enough together that they should be combined > in turn. > > I have thought of some relatively inelegant ways of handling this > ("preprocessing" the time series to create a dummy list in which gaps > have been adjusted over the threshold), but I feel as though there > ought to be a better way to handle it. > > Thanks in advance for any help, > > Michael > > -- http://chris.chiasson.name/
- References:
- grouping similar list elements with gaps
- From: Stern <nycstern@gmail.com>
- grouping similar list elements with gaps