# [R] correlating irregular time series

paul sorenson sourceforge at metrak.com
Mon Nov 14 11:06:35 CET 2005

```I don't have the texts you mention but I get the general idea.  The
diagram I posted shows only a small fraction of the events I have.

Thank you

Christophe Pouzat wrote:
> Hi Paul,
>
> Here is how an amateur statistician deals with this problem when
> analyzing spike trains from simultaneously recorded neurons.
>
> Start by estimating the "hazard function" h(t) of your several point
> processes (if you have a copy of MASS, check out the chapter 13, If you
> have a copy of Jim Lindsey, "The Statistical Analysis of Stochastic
> Processes in Time", check out chap 3 & 4; the hazard function is also
> called the "conditional intensity" or the "stochastic intensity").
>
> In practice if you have a renewal process, meaning that the successive
> intervals between your events times are independent, you can first
> estimate the "Inter Event Interval" pdf, f(t), and its cumulative
> distribution function F(t). h(t) is then given by:
>
> h(t) = f(t) / (1-F(t)),
>
> where the quantity S(t) = 1-F(t) is often called the survivor function.
>
> Fine, now if your processes are well approximated by renewal processes,
> you can look for the distribution of "time to next event" (TTN) and
> "time to former event" (TTF). By that I mean that for each of the black
> events of your figure, you must get the interval separating it from the
> last red event preceding it (the time to former) and the next red event
> following it (the time to next). Under the null hypothesis of no
> correlation these to random variables have the same pdf given by:
>
> TTN(i) = S(i) / <IEI>,
>
> where S(i) in that case is the survivor function of the red (test)
> process and <IEI> is its inter event interval expected value.
> Using this approach I typically estimate the TTN and TTF pdfs with
> histograms and compare these histograms to their expected values under
> the null hypothesis. A warning though, I have most of the time much more
> events than you seem to have on your figure.
>
> Let me know if any of this makes sense.
>
> Christophe.
>
> paul sorenson wrote:
>
>> I have some time stamped events that are supposed to be unrelated.
>>
>> I have plotted them and that assumption does not appear to be valid.
>> http://metrak.com/tmp/sevents.png is a plot showing three sets of
>> events over time.  For the purpose of this exercise, the Y value is
>> irrelevant.  The series are not sampled at the same time and are not
>> equispaced (just events in a log file).
>>
>> The plot is already pretty convincing but requires a human-in-the-loop
>> to zoom in on "hot" areas and then visually interpret the result.  I
>> want to calculate some index of the events' temporal relationship.
>>
>> I think the question I am trying to ask is something like: "If event B
>> occurs, how likely is it that an event A occurred at almost the same
>> time?".
>>
>> Can anyone suggest an established approach that could provide some
>> further insight into this relationship?  I can think of a fairly basic
>> approach where I start out with the ecdf of the time differences but I
>> am guessing I would be reinventing some wheel.
>>
>> Any tips would be most appreciated.
>>
>> cheers
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help