Skip to content
DeepForgeby svx
All problems
HardProbabilitypr-135

Renewal Expected Count

Problem

Expected number of renewals by time horizon for a renewal process whose interarrival distribution is interarrival_pmf, where interarrival_pmf[i] is the probability that a lifetime equals i + 1. Sum P(S_k <= horizon) over k >= 1 using repeated convolution of the pmf. Return 0.0 for an empty distribution or horizon <= 0.

Hint

The renewal function is the sum of the convolution powers evaluated up to the horizon.

Test cases

case 1
in: [[1],5]
expected: 5
case 2
in: [[0.5,0.5],2]
expected: 1.25
case 3
in: [[0.2,0.8],3]
expected: 1.36
case 4
in: [[],5]
expected: 0
Starter codePython
def renewal_expected_count(interarrival_pmf, horizon):
    # Your code here
    pass

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