For a Poisson distribution with rate λ, compute the probability of exactly k events:
P(X=k)=k!e−λλkAlso compute the probability of at most k events:
P(X≤k)=i=0∑ki!e−λλiHere, i is a possible event count and lam represents λ. Return a dictionary containing pmf and cdf as Python floats.
Input: lam = 3.0, k = 2
Output: {"pmf": 0.224042, "cdf": 0.42319}
Explanation: The CDF adds the probabilities for zero, one, and two events.
Input: lam = 2.5, k = 0
Output: {"pmf": 0.082085, "cdf": 0.082085}
Input: lam = 1.0, k = 1
Output: {"pmf": 0.367879, "cdf": 0.735759}
Initialize the zero-event probability with math.exp(-lam).
Advance from count i - 1 to i by multiplying the previous probability by lam / i.
Sign in to take notes on this problem
Accepts: number
Accepts: number
For a Poisson distribution with rate λ, compute the probability of exactly k events:
P(X=k)=k!e−λλkAlso compute the probability of at most k events:
P(X≤k)=i=0∑ki!e−λλiHere, i is a possible event count and lam represents λ. Return a dictionary containing pmf and cdf as Python floats.
Input: lam = 3.0, k = 2
Output: {"pmf": 0.224042, "cdf": 0.42319}
Explanation: The CDF adds the probabilities for zero, one, and two events.
Input: lam = 2.5, k = 0
Output: {"pmf": 0.082085, "cdf": 0.082085}
Input: lam = 1.0, k = 1
Output: {"pmf": 0.367879, "cdf": 0.735759}
Initialize the zero-event probability with math.exp(-lam).
Advance from count i - 1 to i by multiplying the previous probability by lam / i.
Sign in to take notes on this problem
Accepts: number
Accepts: number