cdf
cdf, function
def pure cdf(d : ranvar): zedfunc1
Returns, as a zedunc, the cumulative distribution function of the ranvar d
, defined as .
d
: a ranvar
Example
d = poisson(3)f = cdf(d)show scalar "" a1c3 with f1
2
3
Remarks
The survival function of a ranvar d
can be obtained as 1 - cdf(d)
.
Recipes and best practices
Cumulative and marginal fill rates
In a supply chain context, the cdf
function can be used to compute the cumulative fill rate of an item from its marginal fill rate (which is usually obtained with the fillrate
function):
demand = negativeBinomial(5, 1) // is a ranvarmarginalFillrate = fillrate(demand) // is a ranvarcumulativeFillrate = cdf(marginalFillrate) // is a zedfunc show scalar "Demand" a4 with demandshow scalar "Marginal fill rate" b4 with marginalFillrateshow scalar "Cumulative fill rate" c4 with cumulativeFillrate1
2
3
4
5
6
7
Sell-through function
Also in a supply chain context, cdf
can be used to compute the sell-through function, that is the function that maps each positive integer k
to the probability of selling at least k
units :
demand = negativeBinomial(5, 1)sellThrough = 1 - cdf(demand + 1) show scalar "Demand" a5 with demandshow scalar "Sell-through function" c6 with sellThrough1
2
3
4
5
Computing probabilities
More generally, combined with valueAt
, the cdf
function can be used to compute the probablity of various events related to d
(which can also be done with int
, intLeft
or intRight
):
d = poisson(3)f = cdf(d) show summary "P[d <= 4]" with valueAt(f, 4) // 0.82 intLeft(d, 4) // 0.82 show summary "P[d > 2]" with valueAt(1-f, 2) // 0.58 intRight(d, 3) // 0.58 show summary "P[d >= 2]" with valueAt(1-f, 1) // 0.80 intRight(d, 2) // 0.80 show summary "P[d > 2 and d <= 4]" with valueAt(f, 4) - valueAt(f, 2) // 0.39 int(d, 3, 4) // 0.39 show summary "P[d >= 2 and d <= 4]" with valueAt(f, 4) - valueAt(f, 1) // 0.62 int(d, 2, 4) // 0.621
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22