[R] Identifying peaks (or offsets) in a time series

From: Tauber, Dr E. <et22_at_leicester.ac.uk>
Date: Tue 25 Jul 2006 - 01:16:07 EST

Dear R-users,

We are monitoring the activity of animals during a few days period. The data from each animal (crossing of infra-red beam) are collected as a time series (in 30 min bins). An example is attached below.

y <-


8,16,19,34,39,33,3,67,0,68,34,65,84,61,100,85,108,124,141,139,134,96,54, 91,54,12,0,0,0,0,0,0,0,0,0,0,0,4,11,0,19,27,15,12,20)

We would like to have an automatic way, using R, to identify the time point of offset of each bout of activity (i.e. when activity goes down to a minimum value, for a defined duration). In the example above the offset times (the element number) should be approximately: 53, 99, 146, 191, 239, 283, 330 (the last bout of activity can be ignores).  

Any help or advice will be greatly appreciated,

Many thanks, Eran  

Eran Tauber (PhD)
Lecturer in Molecular Evolution
Dept. of Genetics
University of Leicester
University Rd, Leicester LE1 7RH

Phone: 44 (0)116 252-3455, 252-3421 (lab) Fax: 44 (0)116 252-3378 www.le.ac.uk/genetics/et22

R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Tue Jul 25 01:37:31 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 25 Jul 2006 - 18:24:10 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.