4
$\begingroup$

I have some discrete times of events and I would like to do a test to see if they are likely to have come from a homogeneous Poisson process.

From this pdf, I see:

REMARK 6.3 ( TESTING POISSON ) The above theorem may also be used to test the hypothesis that a given counting process is a Poisson process. This may be done by observing the process for a fixed time $t$. If in this time period we observed n occurrences and if the process is Poisson, then the unordered occurrence times would be independently and uniformly distributed on $(0, t]$. Hence, we may test if the process is Poisson by testing the hypothesis that the n occurrence times come from a uniform $(0, t]$ population. This may be done by standard statistical procedures such as the Kolmogorov-Smirov test.

However I don't quite understand what to do in practice. Say my times are

[1, 7, 18, 22, 41, 43, 66, 73, 86, 92]

and the time interval I chose was from $1$ to $100$. How exactly do I do the Kolmogorov-Smirov test in this example?

$\endgroup$
3
$\begingroup$

If you like Python / numpy / matplotlib, here is a small example demonstrating Remark 6.3:

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import scipy.stats
# interval between two events is distributed as an exponential
>>> delta_t = scipy.stats.expon.rvs(size=10000)
>>> t = np.cumsum(delta_t)
>>> plt.hist(t/t.max(), 200)
>>> plt.show() # see how much uniform it is
# perform the ks test (second value returned is the p-value)
>>> scipy.stats.kstest(t/t.max(), 'uniform')
$\endgroup$
  • $\begingroup$ Thank you. Is there a problem with my data being discrete? (I do like python/matplotlib.) $\endgroup$ – Anush Sep 17 '13 at 13:35
  • $\begingroup$ Sorry what do you mean by data being discrete ? You mean elements in data are integers ? $\endgroup$ – Mr Renard Sep 17 '13 at 14:00
  • $\begingroup$ Yes that is what I meant. $\endgroup$ – Anush Sep 17 '13 at 14:16
  • $\begingroup$ Ok then then it is not really anymore a statistics matter. I guess the poisson process approximation is still valid as long as rounding to integers has minor impact on real time values. You can try to plot delta_t for your dataset and check if it looks like an exponential distribution or a comb. As an example, if you try delta_t = scipy.stats.expon.rvs(scale=1., size=10000) followed by plt.hist(np.around(delta_t), 200), you will see a comb. If you redo the exercise with scale=20, then you will notice that the distribution is much more like an exponential shape. $\endgroup$ – Mr Renard Sep 17 '13 at 15:28
  • 1
    $\begingroup$ @Anush The Kolmogorov-Smirov does not apply to discrete distributions! For Poisson you have to do it the way that is shown in this answer. For count data (which has to time stamps) you cannot apply the test. An alternative would be likelihood tests in that case for example. $\endgroup$ – Jojo Sep 3 '18 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.