cdf
cdf, function
def pure cdf(d : ranvar): zedfunc
Returns, as a zedunc, the cumulative distribution function of the ranvar d
, defined as $ k \mapsto \mathbb{P}[d \leq k]$.
d
: a ranvar
Example
d = poisson(3)
f = cdf(d)
show scalar "" a1c3 with f
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 ranvar
marginalFillrate = fillrate(demand) // is a ranvar
cumulativeFillrate = cdf(marginalFillrate) // is a zedfunc
show scalar "Demand" a4 with demand
show scalar "Marginal fill rate" b4 with marginalFillrate
show scalar "Cumulative fill rate" c4 with cumulativeFillrate
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 demand
show scalar "Sell-through function" c6 with sellThrough
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.62