# Distribution of counts for event-sequence

I work with event sequence. Let's say I observe LED blinking. My sequence will look like black spikes on figure. Intervals between events distributed similarly (but not absolutely) to $\gamma$ with coefficient of variation 0.6-0.7. (Mean and $\sigma$ may vary).

Next, I divide sequence for several bins of the same duration (red lines) and count number of events in each bin (variable $Count$). I calculate average $Count$ let's call it $M_{Count}$ additionally I calculate standard deviation (or other measure of variance) of inter-events intervals for each bin and average it so i have $STD_{intervals}$.

I should calculate p-value for each $M_{Count}$ and $STD_{intervals}$ under assumption, that process is memoryless, or in other words that intervals are independent. For this I may use bootstrap methods, but I need analytical at least asymptotic solution, as bootstrap in my case is very time-demanding- i have thousands sequences 100-200 events each.

Could you help me to obtain a null-distributions for both $M_{Count}$ and $STD_{intervals}$

If the intervals are independently distributed according to the same gamma distribution, then the distribution of counts would be negative binomially distributed.

The mean of that negative binomial will be $\alpha \beta$, where $\alpha$ is the shape parameter of your gamma distribution and $\beta$ is its rate parameter. The variance of that negative binomial distribution will be $\alpha \beta^2$ (see section 4 of this document). If your bins vary in length, then $\beta$ for each bin will be proportional to the reciprocal of bin width (and the shape parameter will be independent of bin width).

The simplest way to look for extreme $M_{count}$ values would be to treat your negative binomial distribution as a null distribution and compare your values of $M_{count}$ to its tails (e.g. using the negative binomial cumulative distribution function).

The distribution for the standard deviation of the intervals won't have a simple equation, but the shape parameter might work for you, depending on what you want.

If you're looking for excess clustering beyond the baseline gamma rate (e.g. some events are too close together and some events are too far apart to be explained by random samples from the same process that produced the other bins), you could find evidence of this using the gamma distribution's shape parameter. If the shape parameter for one bin is too small to be consistent with the global shape, then that would be evidence that this bin was significantly more "bursty" than the others.

Count data can be modeled with the Poisson or compound Poisson process depending on how frequently the events occur and in the case of the compound Poisson if they occur in clusters. In the case of the simple Poisson the time between events has an exponential distribution with rate parameter $\lambda$ which determines the frequency of occurence.

• In my case time between events has a gamma distribution. And I need the distribution of Count in bins. Definetly it should depends from size of bin. – zlon Feb 16 '17 at 17:20