Skip to content

Commit 9e72f1f

Browse files
authored
Clarify definitions of inverse CDF functions (#1814)
* Clarify definitions of inverse CDF functions * Such that to for which * Wrap "generalized" in parentheses
1 parent b2d7652 commit 9e72f1f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/univariates.jl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ std(d::UnivariateDistribution) = sqrt(var(d))
182182
"""
183183
median(d::UnivariateDistribution)
184184
185-
Return the median value of distribution `d`. The median is the smallest `x` such that `cdf(d, x) ≥ 1/2`.
185+
Return the median value of distribution `d`. The median is the smallest `x` in the support
186+
of `d` for which `cdf(d, x) ≥ 1/2`.
186187
Corresponding to this definition as 1/2-quantile, a fallback is provided calling the `quantile` function.
187188
"""
188189
median(d::UnivariateDistribution) = quantile(d, 1//2)
@@ -381,7 +382,10 @@ logccdf(d::UnivariateDistribution, x::Real) = log(ccdf(d, x))
381382
"""
382383
quantile(d::UnivariateDistribution, q::Real)
383384
384-
Evaluate the inverse cumulative distribution function at `q`.
385+
Evaluate the (generalized) inverse cumulative distribution function at `q`.
386+
387+
For a given `0 ≤ q ≤ 1`, `quantile(d, q)` is the smallest value `x` in the support of `d`
388+
for which `cdf(d, x) ≥ q`.
385389
386390
See also: [`cquantile`](@ref), [`invlogcdf`](@ref), and [`invlogccdf`](@ref).
387391
"""
@@ -397,14 +401,20 @@ cquantile(d::UnivariateDistribution, p::Real) = quantile(d, 1.0 - p)
397401
"""
398402
invlogcdf(d::UnivariateDistribution, lp::Real)
399403
400-
The inverse function of logcdf.
404+
The (generalized) inverse function of [`logcdf`](@ref).
405+
406+
For a given `lp ≤ 0`, `invlogcdf(d, lp)` is the smallest value `x` in the support of `d` for
407+
which `logcdf(d, x) ≥ lp`.
401408
"""
402409
invlogcdf(d::UnivariateDistribution, lp::Real) = quantile(d, exp(lp))
403410

404411
"""
405412
invlogccdf(d::UnivariateDistribution, lp::Real)
406413
407-
The inverse function of logccdf.
414+
The (generalized) inverse function of [`logccdf`](@ref).
415+
416+
For a given `lp ≤ 0`, `invlogccdf(d, lp)` is the smallest value `x` in the support of `d`
417+
for which `logccdf(d, x) ≤ lp`.
408418
"""
409419
invlogccdf(d::UnivariateDistribution, lp::Real) = quantile(d, -expm1(lp))
410420

0 commit comments

Comments
 (0)