stats/dist
dist-normal
(dist-normal [mu : float sigma : float] :)
construct a Normal(mu, sigma) distribution object.
| mu | :float mean | |
| sigma | :float standard deviation (> 0) |
:int dist handle. Free with dist-free.
(let [d (dist-normal 0.0 1.0)] (pdf d 0.0)) ; => ~0.3989
Since: ST3
dist-t
(dist-t [df : float] :)
construct a Student t(df) distribution.
| df | :float degrees of freedom (> 0) |
:int dist handle.
Since: ST3
dist-chi2
(dist-chi2 [df : float] :)
construct a chi-squared(df) distribution.
| df | :float degrees of freedom (> 0) |
:int dist handle.
Since: ST3
dist-f
(dist-f [df1 : float df2 : float] :)
construct an F(df1, df2) distribution.
| df1 | :float numerator df | |
| df2 | :float denominator df |
:int dist handle.
Since: ST3
dist-uniform
(dist-uniform [a : float b : float] :)
construct a Uniform(a, b) distribution.
| a | :float lower bound | |
| b | :float upper bound (b > a) |
:int dist handle.
Since: ST4
dist-binomial
(dist-binomial [n : int p : float] :)
construct a Binomial(n, p) distribution.
| n | :int number of trials | |
| p | :float success probability in [0,1] |
:int dist handle.
Since: ST4
dist-poisson
(dist-poisson [lambda : float] :)
construct a Poisson(lambda) distribution.
| lambda | :float rate parameter (> 0) |
:int dist handle.
Since: ST4
dist-exponential
(dist-exponential [rate : float] :)
construct an Exponential(rate) distribution.
| rate | :float rate = 1/mean (> 0) |
:int dist handle.
Since: ST4
dist-beta
(dist-beta [alpha : float beta : float] :)
construct a Beta(alpha, beta) distribution.
| alpha | :float shape1 (> 0) | |
| beta | :float shape2 (> 0) |
:int dist handle.
Since: ST4
dist-gamma
(dist-gamma [shape : float rate : float] :)
construct a Gamma(shape, rate) distribution.
| shape | :float shape parameter (> 0) | |
| rate | :float rate = 1/scale (> 0) |
:int dist handle.
Since: ST4
dist-free
(dist-free [d : int] :)
free a distribution object.
Since: ST3
(pdf [d : int x : float] :)
probability density (or mass) at x.
| d | :int dist handle | |
| x | :float argument |
:float density / PMF value.
Since: ST3
cdf
(cdf [d : int x : float] :)
cumulative distribution function P(X <= x).
| d | :int dist handle | |
| x | :float argument |
:float P(X <= x) in [0, 1].
Since: ST3
quantile
(quantile [d : int p : float] :)
inverse CDF (quantile function).
| d | :int dist handle | |
| p | :float probability in [0, 1] |
:float x such that CDF(x) ~= p.
Since: ST3
random
(random [d : int rng : int] :)
draw one sample from a distribution.
| d | :int dist handle | |
| rng | :int rng handle (from rng-make) |
:float one sample.
Since: ST3
random-n
(random-n [d : int rng : int n : int] :)
draw n samples from a distribution into a float64 column.
| d | :int dist handle | |
| rng | :int rng handle | |
| n | :int number of samples |
:int new float64 column of length n. Caller frees.
Since: ST3
dnorm
(dnorm [x : float mu : float sigma : float] :)
normal density at x.
Since: ST4
pnorm
(pnorm [x : float mu : float sigma : float] :)
normal CDF at x.
Since: ST4
qnorm
(qnorm [p : float mu : float sigma : float] :)
normal quantile at p.
Since: ST4
rnorm
(rnorm [rng : int n : int mu : float sigma : float] :)
n normal samples.
Since: ST4
dt
(dt [x : float df : float] :)
t density.
Since: ST4
pt
(pt [x : float df : float] :)
t CDF.
Since: ST4
qt
(qt [p : float df : float] :)
t quantile.
Since: ST4
rt
(rt [rng : int n : int df : float] :)
n t samples.
Since: ST4
dchi2
(dchi2 [x : float df : float] :)
chi-squared density.
Since: ST4
pchi2
(pchi2 [x : float df : float] :)
chi-squared CDF.
Since: ST4
qchi2
(qchi2 [p : float df : float] :)
chi-squared quantile.
Since: ST4
rchi2
(rchi2 [rng : int n : int df : float] :)
n chi-squared samples.
Since: ST4
df-dist
(df-dist [x : float df1 : float df2 : float] :)
F density.
Since: ST4
pf-dist
(pf-dist [x : float df1 : float df2 : float] :)
F CDF.
Since: ST4
qf-dist
(qf-dist [p : float df1 : float df2 : float] :)
F quantile.
Since: ST4
rf-dist
(rf-dist [rng : int n : int df1 : float df2 : float] :)
n F samples.
Since: ST4
dunif
(dunif [x : float a : float b : float] :)
uniform density.
Since: ST4
punif
(punif [x : float a : float b : float] :)
uniform CDF.
Since: ST4
qunif
(qunif [p : float a : float b : float] :)
uniform quantile.
Since: ST4
runif
(runif [rng : int n : int a : float b : float] :)
n uniform samples.
Since: ST4
dbinom
(dbinom [x : float n : int p : float] :)
binomial PMF.
Since: ST4
pbinom
(pbinom [x : float n : int p : float] :)
binomial CDF.
Since: ST4
qbinom
(qbinom [p : float n : int pp : float] :)
binomial quantile.
Since: ST4
rbinom
(rbinom [rng : int n-samp : int n-trials : int p : float] :)
n binomial samples.
Since: ST4
dpois
(dpois [x : float lambda : float] :)
Poisson PMF.
Since: ST4
ppois
(ppois [x : float lambda : float] :)
Poisson CDF.
Since: ST4
qpois
(qpois [p : float lambda : float] :)
Poisson quantile.
Since: ST4
rpois
(rpois [rng : int n : int lambda : float] :)
n Poisson samples.
Since: ST4
dexp
(dexp [x : float rate : float] :)
exponential density.
Since: ST4
pexp
(pexp [x : float rate : float] :)
exponential CDF.
Since: ST4
qexp
(qexp [p : float rate : float] :)
exponential quantile.
Since: ST4
rexp
(rexp [rng : int n : int rate : float] :)
n exponential samples.
Since: ST4
dbeta
(dbeta [x : float alpha : float beta : float] :)
beta density.
Since: ST4
pbeta
(pbeta [x : float alpha : float beta : float] :)
beta CDF.
Since: ST4
qbeta
(qbeta [p : float alpha : float beta : float] :)
beta quantile.
Since: ST4
rbeta
(rbeta [rng : int n : int alpha : float beta : float] :)
n beta samples.
Since: ST4
dgamma
(dgamma [x : float shape : float rate : float] :)
gamma density.
Since: ST4
pgamma
(pgamma [x : float shape : float rate : float] :)
gamma CDF.
Since: ST4
qgamma
(qgamma [p : float shape : float rate : float] :)
gamma quantile.
Since: ST4
rgamma
(rgamma [rng : int n : int shape : float rate : float] :)
n gamma samples.
Since: ST4