•distribution — Distributions
params •distribution name returns the distribution called name, with parameters params. •distribution name uses the distribution’s standard parameters, listed in the table below. A distribution is a keyed vector of four functions:
sample shapedraws random values from the session’s stream, as¿does.g sample shapedraws them from a generator made by•rand.density xgives the probability density, or the probability mass for a discrete distribution.cdf xgives P(X ≤ x).quantile pinverts the CDF.cdf⁻¹isquantile.quantile⁻¹iscdf.
d←•distribution "normal"
d.cdf 0 ⍝ 0.5
b←10 0.5 •distribution "binomial"
b.quantile 0.5 ⍝ 5ₓParameters are finite real units or vectors. Scale, shape, rate and degrees of freedom are positive, except where stated. Distributions shows them in use.
| Name | Parameters | Standard |
|---|---|---|
"normal" |
μ σ: mean, standard deviation | 0 1 |
"uniform" |
a b: lower and upper bounds, a < b | 0 1 |
"bernoulli" |
p ∈ [0,1] | |
"binomial" |
n p: integer trials n ≥ 0, p ∈ [0,1] | |
"poisson" |
λ ≥ 0: mean | |
"beta" |
α β: shapes | |
"gamma" |
k θ: shape, scale, with mean kθ | |
"inversegamma" |
α β: shape, scale, with density ∝ x⁻⁽ᵅ⁺¹⁾ exp(−β/x) | |
"exponential" |
λ: rate, with mean 1/λ | 1 |
"chisquared" |
ν: degrees of freedom | |
"student" |
ν: degrees of freedom, with location 0 and scale 1 | |
"fisher" |
ν₁ ν₂: degrees of freedom | |
"cauchy", "laplace", "logistic" |
location, scale | 0 1 |
"lognormal" |
μ σ: mean and standard deviation of log(X) | 0 1 |
"weibull" |
k λ: shape, scale |
Errors: DOMAIN for an unknown name, a name that isn’t a string, a monadic call for a distribution with no standard parameters, invalid parameters, non-real inputs or p ∉ [0,1]; LENGTH for the wrong number of parameters; RANK for matrix parameters or shapes; SYNTAX for a dyadic call to density, cdf or quantile; LIMIT for oversized shapes or sampler ranges.