Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-112

Poisson Waiting Time Probability

Problem

Probability that the k-th event of a Poisson process with rate lam has occurred by time t, which is the probability of at least k events in [0, t]:

P(T_k <= t) = 1 - sum from i = 0 to k - 1 of e^(-lam t) (lam t)^i / i!.

Return 1.0 for k <= 0 and 0.0 for negative rates or times.

Hint

The waiting time is Erlang distributed; use the Poisson count complement.

Test cases

case 1
in: [1,1,1]
expected: 0.6321205588285577
case 2
in: [2,3,2]
expected: 0.9826487347633355
case 3
in: [1,1,0]
expected: 1
case 4
in: [1,1,3]
expected: 0.08030139707139416
case 5
in: [1,-1,1]
expected: 0
Starter codePython
import math


def poisson_waiting_time_probability(lam, t, k):
    # Your code here
    pass

5 test cases · run your code against them in the editor