how to count events in time intervals. input is vector of event times
Hello all,
The question says it all. How can RM pre-processing be arranged to solve the following counting problem. Suppose events occur at times 0.7, 2.5, 2.6, 3.9. I want to count the events in uniformly spaced intervals. For examples, if the intervals are [0,1), [1,2), [2,3), [3,4) then the events would fall into groups (0.7)()(2.5,2.6)(3.9) and the counts for this data would be 1,0,2,1. So the output is a timeseries 1, 0, 2, 1.
I have got as far as creating an input file and reading it into RM with a CSV reader.
event_times.txt =======
0.7
2.5
2.6
3.9
=============
There are fancy operators to create a Markup via value dimension, but I think I want to create Markup uniformly on the displacement dimension (time is a displacement dimension, yes?). And when that is done, how do I use the Markup to obtain count data?
I have the ValueSeries plugin, RM5.3. Also, when I import, the data, what role should I choose for the event times? id?
Do I need to augment the event times with some trivial value data like
0.7 1
2.5 1
2.6 1
3.9 1
I appreciate any suggestions or examples you may have.
Thank you,
Owen
The question says it all. How can RM pre-processing be arranged to solve the following counting problem. Suppose events occur at times 0.7, 2.5, 2.6, 3.9. I want to count the events in uniformly spaced intervals. For examples, if the intervals are [0,1), [1,2), [2,3), [3,4) then the events would fall into groups (0.7)()(2.5,2.6)(3.9) and the counts for this data would be 1,0,2,1. So the output is a timeseries 1, 0, 2, 1.
I have got as far as creating an input file and reading it into RM with a CSV reader.
event_times.txt =======
0.7
2.5
2.6
3.9
=============
There are fancy operators to create a Markup via value dimension, but I think I want to create Markup uniformly on the displacement dimension (time is a displacement dimension, yes?). And when that is done, how do I use the Markup to obtain count data?
I have the ValueSeries plugin, RM5.3. Also, when I import, the data, what role should I choose for the event times? id?
Do I need to augment the event times with some trivial value data like
0.7 1
2.5 1
2.6 1
3.9 1
I appreciate any suggestions or examples you may have.
Thank you,
Owen
0
Answers
I made some progress which is shown in the code below. First it generates a set of 80 random time arrivals within a time of 60 seconds. Then calculates an attribute interval_id that tells which 5-second interval contains each example. Then it counts the number of examples in each interval. You can compare the two output example-sets to see that the counting seems correct.
Question. This code is a proof-of-concept. Is there a better way to do this? It seems there are several operators that hint at this functionality, especially in the Series plugin. For example
- Windowing (Series; Intervals) (Series)
- Transform Intervals (Series)
- Windowing (Series).
Code follows.Regards,
Owen