All problems
Thinning of a Poisson Process
Problem
Each event of a Poisson process with rate lam is independently kept with probability p. Return the probability that exactly k kept events occur in time t.
The thinned process is Poisson with rate lam * p. Return 0.0 for invalid probabilities or negative inputs.
Hint
Independent thinning preserves the Poisson property with a reduced rate.
Test cases
case 1
in: [2,0.5,2,1]
expected: 0.2706705664732254
case 2
in: [3,1,1,2]
expected: 0.22404180765538775
case 3
in: [5,0,1,0]
expected: 1
case 4
in: [1,2,1,1]
expected: 0
Starter codePython
import math
def thinning_poisson_probability(lam, p, t, k):
# Your code here
pass4 test cases · run your code against them in the editor