9.6 Low-Level Distribution Functions
The following functions are provided for users who need lower overhead than that of distribution objects, such as untyped Racket users (currently), and library writers who are implementing their own distribution abstractions.
Because applying these functions is meant to be fast, none of them have optional arguments. In particular, the boolean flags log? and 1-p? are always required.
Every low-level function’s argument list begins with the distribution family parameters. In the case of pdfs and cdfs, these arguments are followed by a domain value and boolean flags. In the case of inverse cdfs, they are followed by a probability argument and boolean flags. For sampling procedures, the distribution family parameters are followed by the requested number of random samples.
Generally, prob is a probability parameter, k is an integer domain value, x is a real domain value, p is the probability argument to an inverse cdf, and n is the number of random samples.
9.6.1 Integer Distribution Functions
procedure
(flbernoulli-pdf prob k log?) → Flonum
prob : Flonum k : Flonum log? : Any
procedure
(flbernoulli-cdf prob k log? 1-p?) → Flonum
prob : Flonum k : Flonum log? : Any 1-p? : Any
procedure
(flbernoulli-inv-cdf prob p log? 1-p?) → Flonum
prob : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flbernoulli-sample prob n) → FlVector
prob : Flonum n : Integer
procedure
(flbinomial-pdf count prob k log?) → Flonum
count : Flonum prob : Flonum k : Flonum log? : Any
procedure
(flbinomial-cdf count prob k log? 1-p?) → Flonum
count : Flonum prob : Flonum k : Flonum log? : Any 1-p? : Any
procedure
(flbinomial-inv-cdf count prob p log? 1-p?) → Flonum
count : Flonum prob : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flbinomial-sample count prob n) → FlVector
count : Flonum prob : Flonum n : Integer
procedure
(flgeometric-pdf prob k log?) → Flonum
prob : Flonum k : Flonum log? : Any
procedure
(flgeometric-cdf prob k log? 1-p?) → Flonum
prob : Flonum k : Flonum log? : Any 1-p? : Any
procedure
(flgeometric-inv-cdf prob p log? 1-p?) → Flonum
prob : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flgeometric-sample prob n) → FlVector
prob : Flonum n : Integer
procedure
(flpoisson-pdf mean k log?) → Flonum
mean : Flonum k : Flonum log? : Any
procedure
(flpoisson-cdf mean k log? 1-p?) → Flonum
mean : Flonum k : Flonum log? : Any 1-p? : Any
procedure
(flpoisson-inv-cdf mean p log? 1-p?) → Flonum
mean : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flpoisson-sample mean n) → FlVector
mean : Flonum n : Integer
procedure
(flpoisson-median mean) → Flonum
mean : Flonum
(flpoisson-median mean) runs faster than (flpoisson-inv-cdf mean 0.5 #f #f), significantly so when mean is large.
9.6.2 Real Distribution Functions
procedure
(flbeta-pdf alpha beta x log?) → Flonum
alpha : Flonum beta : Flonum x : Flonum log? : Any
procedure
(flbeta-cdf alpha beta x log? 1-p?) → Flonum
alpha : Flonum beta : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(flbeta-inv-cdf alpha beta p log? 1-p?) → Flonum
alpha : Flonum beta : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flbeta-sample alpha beta n) → FlVector
alpha : Flonum beta : Flonum n : Integer
procedure
(flcauchy-pdf mode scale x log?) → Flonum
mode : Flonum scale : Flonum x : Flonum log? : Any
procedure
(flcauchy-cdf mode scale x log? 1-p?) → Flonum
mode : Flonum scale : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(flcauchy-inv-cdf mode scale p log? 1-p?) → Flonum
mode : Flonum scale : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flcauchy-sample mode scale n) → FlVector
mode : Flonum scale : Flonum n : Integer
procedure
(fldelta-pdf mean x log?) → Flonum
mean : Flonum x : Flonum log? : Any
procedure
(fldelta-cdf mean x log? 1-p?) → Flonum
mean : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(fldelta-inv-cdf mean p log? 1-p?) → Flonum
mean : Flonum p : Flonum log? : Any 1-p? : Any
To get delta-distributed random samples, use (make-flvector n mean).
procedure
(flexponential-pdf mean x log?) → Flonum
mean : Flonum x : Flonum log? : Any
procedure
(flexponential-cdf mean x log? 1-p?) → Flonum
mean : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(flexponential-inv-cdf mean p log? 1-p?) → Flonum
mean : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flexponential-sample mean n) → FlVector
mean : Flonum n : Integer
procedure
(flgamma-pdf shape scale x log?) → Flonum
shape : Flonum scale : Flonum x : Flonum log? : Any
procedure
(flgamma-cdf shape scale x log? 1-p?) → Flonum
shape : Flonum scale : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(flgamma-inv-cdf shape scale p log? 1-p?) → Flonum
shape : Flonum scale : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flgamma-sample shape scale n) → FlVector
shape : Flonum scale : Flonum n : Integer
procedure
(fllogistic-pdf mean scale x log?) → Flonum
mean : Flonum scale : Flonum x : Flonum log? : Any
procedure
(fllogistic-cdf mean scale x log? 1-p?) → Flonum
mean : Flonum scale : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(fllogistic-inv-cdf mean scale p log? 1-p?) → Flonum
mean : Flonum scale : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(fllogistic-sample mean scale n) → FlVector
mean : Flonum scale : Flonum n : Integer
procedure
(flnormal-pdf mean stddev x log?) → Flonum
mean : Flonum stddev : Flonum x : Flonum log? : Any
procedure
(flnormal-cdf mean stddev x log? 1-p?) → Flonum
mean : Flonum stddev : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(flnormal-inv-cdf mean stddev p log? 1-p?) → Flonum
mean : Flonum stddev : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(flnormal-sample mean stddev n) → FlVector
mean : Flonum stddev : Flonum n : Integer
procedure
(fltriangle-pdf min max mode x log?) → Flonum
min : Flonum max : Flonum mode : Flonum x : Flonum log? : Any
procedure
(fltriangle-cdf min max mode x log? 1-p?) → Flonum
min : Flonum max : Flonum mode : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(fltriangle-inv-cdf min max mode p log? 1-p?) → Flonum
min : Flonum max : Flonum mode : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(fltriangle-sample min max mode n) → FlVector
min : Flonum max : Flonum mode : Flonum n : Integer
procedure
(fluniform-pdf min max x log?) → Flonum
min : Flonum max : Flonum x : Flonum log? : Any
procedure
(fluniform-cdf min max x log? 1-p?) → Flonum
min : Flonum max : Flonum x : Flonum log? : Any 1-p? : Any
procedure
(fluniform-inv-cdf min max p log? 1-p?) → Flonum
min : Flonum max : Flonum p : Flonum log? : Any 1-p? : Any
procedure
(fluniform-sample min max n) → FlVector
min : Flonum max : Flonum n : Integer