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
函数
(flbernoulli-pdf prob k log?) → Flonum
prob : Flonum k : Flonum log? : Any
函数
(flbernoulli-cdf prob k log? 1-p?) → Flonum
prob : Flonum k : Flonum log? : Any 1-p? : Any
函数
(flbernoulli-inv-cdf prob p log? 1-p?) → Flonum
prob : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flbernoulli-sample prob n) → FlVector
prob : Flonum n : Integer
函数
(flbinomial-pdf count prob k log?) → Flonum
count : Flonum prob : Flonum k : Flonum log? : Any
函数
(flbinomial-cdf count prob k log? 1-p?) → Flonum
count : Flonum prob : Flonum k : Flonum log? : Any 1-p? : Any
函数
(flbinomial-inv-cdf count prob p log? 1-p?) → Flonum
count : Flonum prob : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flbinomial-sample count prob n) → FlVector
count : Flonum prob : Flonum n : Integer
函数
(flgeometric-pdf prob k log?) → Flonum
prob : Flonum k : Flonum log? : Any
函数
(flgeometric-cdf prob k log? 1-p?) → Flonum
prob : Flonum k : Flonum log? : Any 1-p? : Any
函数
(flgeometric-inv-cdf prob p log? 1-p?) → Flonum
prob : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flgeometric-sample prob n) → FlVector
prob : Flonum n : Integer
函数
(flpoisson-pdf mean k log?) → Flonum
mean : Flonum k : Flonum log? : Any
函数
(flpoisson-cdf mean k log? 1-p?) → Flonum
mean : Flonum k : Flonum log? : Any 1-p? : Any
函数
(flpoisson-inv-cdf mean p log? 1-p?) → Flonum
mean : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flpoisson-sample mean n) → FlVector
mean : Flonum n : Integer
函数
(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
函数
(flbeta-pdf alpha beta x log?) → Flonum
alpha : Flonum beta : Flonum x : Flonum log? : Any
函数
(flbeta-cdf alpha beta x log? 1-p?) → Flonum
alpha : Flonum beta : Flonum x : Flonum log? : Any 1-p? : Any
函数
(flbeta-inv-cdf alpha beta p log? 1-p?) → Flonum
alpha : Flonum beta : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flbeta-sample alpha beta n) → FlVector
alpha : Flonum beta : Flonum n : Integer
函数
(flcauchy-pdf mode scale x log?) → Flonum
mode : Flonum scale : Flonum x : Flonum log? : Any
函数
(flcauchy-cdf mode scale x log? 1-p?) → Flonum
mode : Flonum scale : Flonum x : Flonum log? : Any 1-p? : Any
函数
(flcauchy-inv-cdf mode scale p log? 1-p?) → Flonum
mode : Flonum scale : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flcauchy-sample mode scale n) → FlVector
mode : Flonum scale : Flonum n : Integer
函数
(fldelta-pdf mean x log?) → Flonum
mean : Flonum x : Flonum log? : Any
函数
(fldelta-cdf mean x log? 1-p?) → Flonum
mean : Flonum x : Flonum log? : Any 1-p? : Any
函数
(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).
函数
(flexponential-pdf mean x log?) → Flonum
mean : Flonum x : Flonum log? : Any
函数
(flexponential-cdf mean x log? 1-p?) → Flonum
mean : Flonum x : Flonum log? : Any 1-p? : Any
函数
(flexponential-inv-cdf mean p log? 1-p?) → Flonum
mean : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flexponential-sample mean n) → FlVector
mean : Flonum n : Integer
函数
(flgamma-pdf shape scale x log?) → Flonum
shape : Flonum scale : Flonum x : Flonum log? : Any
函数
(flgamma-cdf shape scale x log? 1-p?) → Flonum
shape : Flonum scale : Flonum x : Flonum log? : Any 1-p? : Any
函数
(flgamma-inv-cdf shape scale p log? 1-p?) → Flonum
shape : Flonum scale : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flgamma-sample shape scale n) → FlVector
shape : Flonum scale : Flonum n : Integer
函数
(fllogistic-pdf mean scale x log?) → Flonum
mean : Flonum scale : Flonum x : Flonum log? : Any
函数
(fllogistic-cdf mean scale x log? 1-p?) → Flonum
mean : Flonum scale : Flonum x : Flonum log? : Any 1-p? : Any
函数
(fllogistic-inv-cdf mean scale p log? 1-p?) → Flonum
mean : Flonum scale : Flonum p : Flonum log? : Any 1-p? : Any
函数
(fllogistic-sample mean scale n) → FlVector
mean : Flonum scale : Flonum n : Integer
函数
(flnormal-pdf mean stddev x log?) → Flonum
mean : Flonum stddev : Flonum x : Flonum log? : Any
函数
(flnormal-cdf mean stddev x log? 1-p?) → Flonum
mean : Flonum stddev : Flonum x : Flonum log? : Any 1-p? : Any
函数
(flnormal-inv-cdf mean stddev p log? 1-p?) → Flonum
mean : Flonum stddev : Flonum p : Flonum log? : Any 1-p? : Any
函数
(flnormal-sample mean stddev n) → FlVector
mean : Flonum stddev : Flonum n : Integer
函数
(fltriangle-pdf min max mode x log?) → Flonum
min : Flonum max : Flonum mode : Flonum x : Flonum log? : Any
函数
(fltriangle-cdf min max mode x log? 1-p?) → Flonum
min : Flonum max : Flonum mode : Flonum x : Flonum log? : Any 1-p? : Any
函数
(fltriangle-inv-cdf min max mode p log? 1-p?) → Flonum
min : Flonum max : Flonum mode : Flonum p : Flonum log? : Any 1-p? : Any
函数
(fltriangle-sample min max mode n) → FlVector
min : Flonum max : Flonum mode : Flonum n : Integer
函数
(fluniform-pdf min max x log?) → Flonum
min : Flonum max : Flonum x : Flonum log? : Any
函数
(fluniform-cdf min max x log? 1-p?) → Flonum
min : Flonum max : Flonum x : Flonum log? : Any 1-p? : Any
函数
(fluniform-inv-cdf min max p log? 1-p?) → Flonum
min : Flonum max : Flonum p : Flonum log? : Any 1-p? : Any
函数
(fluniform-sample min max n) → FlVector
min : Flonum max : Flonum n : Integer