Cody

Problem 44451. Rate of event occurence: find percentiles of the distribution (for smallish rates)

Created by David Verrelli in Community

In this problem you need to find the 5th and 95th percentiles of a Poisson distribution defined by parameter μ (the mean rate parameter).

What follows is just a longer introduction to the concepts, including two examples.

Say that you manage the inventory of a business for which orders on average come in at a known rate (daily, say), but for any given period the number of orders can be somewhat above or somewhat below the expected value. If it helps your motivation, you can imagine you're running a stall selling vegan sausages, or in booth handing out free beer, or at a barbecue serving pancakes, ....

The variable of interest, N, is the number of customers/orders within a given period — one day, let's say. The average rate multiplied by the period of interest yields the mean of the distribution (in this problem), which is the 'expected value', or average.

In this problem, N follows a Poisson distribution : N ~ Poisson(μ). So there is no influence of any external factors (weather, trends, etc.). The only parameter having a deterministic effect is μ.

Then the probability of having k customers in a period, given the expected number of customers in that period being equal to μ, is given by: Pr(N=k) = μ^k × exp(−μ) / k!

The caret (^) represents the power operator, and the exclamation mark (!) represents the factorial operation.

If μ and k are given, it is therefore straightforward to compute the probability, Pr(N=k), using the above formula.

However, in this problem you will be given μ, representing the mean ('expected') daily rate, and you thereby need to determine two values of k:

  • A lower limit on the number of customers, k, for which a lower demand will not be faced more than 5% of the time
  • An upper limit on the number of customers, k, that will not be exceeded more than 5% of the time

Hence, you will be sure that, in the long run, the number of customers you see each day will not often (no more than 10% of the time) be outside the range specified by the above two limits.

EXAMPLE 1:

% Input
mu = 10
% Output
lowerLimit = 4
upperLimit = 15
safeLimits = [lowerLimit upperLimit]

Note that the outputs shall be integers, because there is no physical meaning to 'half a customer'.

EXAMPLE 2:

% Input
mu = 100
% Output
lowerLimit = 83
upperLimit = 117
safeLimits = [lowerLimit upperLimit]

NOTE: the two limits are returned as the vector safeLimits, as shown.

NOTE: Toolbox functions are generally not available from within Cody.

Solution Stats

80.0% Correct | 20.0% Incorrect
Last solution submitted on Apr 13, 2019

Problem Comments