Liking cljdoc? Tell your friends :D

org.replikativ.foerster.dist

Probability distributions, portable between the JVM and JavaScript.

A distribution is a value (a record) with

(draw d) a sample, from the current generator (foerster.random: a world's stream at a site) (logpdf d x) the log density, or log mass for a discrete law; ##-Inf outside the support (cdf d x) (quantile d p) (mean d) (variance d) where defined

Names and parameterizations follow raster's distributions (raster.sci.distributions, and Distributions.jl): Normal[mu sigma], Uniform[a b], Exponential[lambda] (rate), Gamma[alpha beta] (shape, SCALE: mean αβ), Beta[alpha beta], Poisson[lambda]. A model's site laws and a raster block's compiled densities therefore mean the same thing.

Probability distributions, portable between the JVM and JavaScript.

A distribution is a value (a record) with

  (draw d)          a sample, from the current generator
                    (`foerster.random`: a world's stream at a site)
  (logpdf d x)      the log density, or log mass for a discrete law;
                    ##-Inf outside the support
  (cdf d x) (quantile d p) (mean d) (variance d)   where defined

Names and parameterizations follow raster's distributions
(`raster.sci.distributions`, and Distributions.jl): Normal[mu sigma],
Uniform[a b], Exponential[lambda] (rate), Gamma[alpha beta] (shape, SCALE:
mean αβ), Beta[alpha beta], Poisson[lambda]. A model's site laws and a
raster block's compiled densities therefore mean the same thing.
raw docstring

bernoulliclj/s

(bernoulli p)

1 with probability p, else 0.

1 with probability p, else 0.
sourceraw docstring

betaclj/s

(beta alpha beta)

Beta(α, β), α, β > 0.

Beta(α, β), α, β > 0.
sourceraw docstring

beta-binomialclj/s

(beta-binomial n alpha beta)

Successes in n ≥ 0 trials of a Beta(α, β) probability: an overdispersed binomial.

Successes in n ≥ 0 trials of a Beta(α, β) probability: an overdispersed binomial.
sourceraw docstring

binomialclj/s

(binomial n p)

Successes in n ≥ 0 trials of success probability p ∈ [0, 1].

Successes in n ≥ 0 trials of success probability p ∈ [0, 1].
sourceraw docstring

categoricalclj/s

(categorical outcomes)

A value with probability ∝ its weight: outcomes a map {value weight} or a sequence of [value weight] pairs.

A value with probability ∝ its weight: `outcomes` a map {value weight}
or a sequence of [value weight] pairs.
sourceraw docstring

cauchyclj/s

(cauchy location scale)

Cauchy with location x₀ and scale γ > 0.

Cauchy with location x₀ and scale γ > 0.
sourceraw docstring

cdfclj/s

(cdf d x)
source

censoredclj/s

(censored d lo hi)

d (a univariate law with a cdf) observed through a clamp to [lo, hi]: an observation at a bound has the probability of lying beyond it — the likelihood of data that saturate a detection limit.

`d` (a univariate law with a `cdf`) observed through a clamp to [lo, hi]:
an observation at a bound has the probability of lying beyond it — the
likelihood of data that saturate a detection limit.
sourceraw docstring

chi-squaredclj/s

(chi-squared k)

χ² with k > 0 degrees of freedom.

χ² with k > 0 degrees of freedom.
sourceraw docstring

Continuousclj/sprotocol

-continuous?clj/s

(-continuous? d)

Whether d is a law on (an interval of) the reals.

Whether `d` is a law on (an interval of) the reals.
source

continuous?clj/s

(continuous? d)

Whether d is a law on (an interval of) the reals: a scalar site a random walk can move.

Whether `d` is a law on (an interval of) the reals: a scalar site a
random walk can move.
sourceraw docstring

dirichletclj/s

(dirichlet alpha)

Dirichlet(α) over the simplex, every αᵢ > 0.

Dirichlet(α) over the simplex, every αᵢ > 0.
sourceraw docstring

discreteclj/s

(discrete weights)

An index i with probability weights[i] / Σ weights; weights ≥ 0.

An index i with probability weights[i] / Σ weights; weights ≥ 0.
sourceraw docstring

Distributionclj/sprotocol

-drawclj/s

(-draw d)

-logpdfclj/s

(-logpdf d x)
source

distribution?clj/s

(distribution? x)
source

drawclj/s

(draw d)

A sample of d.

A sample of `d`.
sourceraw docstring

draw-logpdfclj/s

(draw-logpdf d x)

The log density of x under what (draw d) samples: logpdf, unless d draws from something else (a block's :sample).

The log density of `x` under what `(draw d)` samples: `logpdf`, unless `d`
draws from something else (a block's `:sample`).
sourceraw docstring

DrawDensityclj/sprotocol

-draw-logpdfclj/s

(-draw-logpdf d x)

The log density of x under what draw samples, or nil when that is the distribution itself (logpdf).

The log density of `x` under what `draw` samples, or nil when that is
the distribution itself (`logpdf`).
source

exponentialclj/s

(exponential lambda)

Exponential with rate λ > 0.

Exponential with rate λ > 0.
sourceraw docstring

Finiteclj/sprotocol

-supportclj/s

(-support d)

The values of a distribution with finite support, in order; nil when its support is infinite or continuous.

The values of a distribution with finite support, in order;
nil when its support is infinite or continuous.
source

flipclj/s

(flip p)

true with probability p.

true with probability p.
sourceraw docstring

gammaclj/s

(gamma alpha beta)

Gamma with shape α > 0 and SCALE β > 0 (mean αβ).

Gamma with shape α > 0 and SCALE β > 0 (mean αβ).
sourceraw docstring

gamma-mean-sdclj/s

(gamma-mean-sd m sd)

The gamma with mean m > 0 and standard deviation sd > 0 (shape (m/sd)², scale sd²/m).

The gamma with mean m > 0 and standard deviation sd > 0 (shape (m/sd)²,
scale sd²/m).
sourceraw docstring

gumbelclj/s

(gumbel mu beta)

Gumbel (extreme value) with location μ and scale β > 0.

Gumbel (extreme value) with location μ and scale β > 0.
sourceraw docstring

half-cauchyclj/s

(half-cauchy scale)

|Cauchy(0, γ)|, γ > 0: a heavy-tailed prior for a scale.

|Cauchy(0, γ)|, γ > 0: a heavy-tailed prior for a scale.
sourceraw docstring

half-normalclj/s

(half-normal sigma)

|Normal(0, σ)|, σ > 0: a prior for a scale.

|Normal(0, σ)|, σ > 0: a prior for a scale.
sourceraw docstring

half-student-tclj/s

(half-student-t nu sigma)

|Student-t(ν, 0, σ)|: a prior for a scale, between half-normal and half-Cauchy.

|Student-t(ν, 0, σ)|: a prior for a scale, between half-normal and half-Cauchy.
sourceraw docstring

hurdleclj/s

(hurdle p-zero d)

0 with probability p-zero, otherwise d conditioned to be nonzero: whether anything happens, and how much if it does, as separate parts.

0 with probability `p-zero`, otherwise `d` conditioned to be nonzero:
whether anything happens, and how much if it does, as separate parts.
sourceraw docstring

inverse-gammaclj/s

(inverse-gamma alpha beta)

1/X for X ~ Gamma: shape α > 0 and scale β > 0 (mean β/(α − 1)).

1/X for X ~ Gamma: shape α > 0 and scale β > 0 (mean β/(α − 1)).
sourceraw docstring

laplaceclj/s

(laplace mu b)

Laplace (double exponential) with location μ and scale b > 0.

Laplace (double exponential) with location μ and scale b > 0.
sourceraw docstring

lbetaclj/s

(lbeta a b)
source

lgammaclj/s

(lgamma x)

log Γ(x) (Lanczos, g = 7): about 15 significant digits.

log Γ(x) (Lanczos, g = 7): about 15 significant digits.
sourceraw docstring

log-normalclj/s

(log-normal mu sigma)

exp of Normal(μ, σ), σ > 0.

exp of Normal(μ, σ), σ > 0.
sourceraw docstring

logpdfclj/s

(logpdf d x)

The log density (log mass) of d at x.

The log density (log mass) of `d` at `x`.
sourceraw docstring

meanclj/s

(mean d)
source

Momentsclj/sprotocol

-meanclj/s

(-mean d)

-varianceclj/s

(-variance d)
source

mvnclj/s

(mvn mean cov)

Multivariate normal with mean (a vector) and covariance cov (vectors of rows, symmetric positive definite).

Multivariate normal with `mean` (a vector) and covariance `cov` (vectors of
rows, symmetric positive definite).
sourceraw docstring

negative-binomialclj/s

(negative-binomial r p)

Failures before the r-th success, success probability p ∈ (0, 1]; r > 0 need not be whole.

Failures before the r-th success, success probability p ∈ (0, 1]; r > 0
need not be whole.
sourceraw docstring

normalclj/s

(normal mu sigma)

Normal(μ, σ), σ > 0 the standard deviation.

Normal(μ, σ), σ > 0 the standard deviation.
sourceraw docstring

normal-cdfclj/s

(normal-cdf z)

Φ(z), the standard normal CDF: ½ Q(½, z²/2) below 0, which keeps its relative precision deep into the tail.

Φ(z), the standard normal CDF: ½ Q(½, z²/2) below 0, which keeps its
relative precision deep into the tail.
sourceraw docstring

normal-quantileclj/s

(normal-quantile p)

Φ⁻¹(p) (Wichura 1988, AS241 PPND16): about 16 significant digits.

Φ⁻¹(p) (Wichura 1988, AS241 PPND16): about 16 significant digits.
sourceraw docstring

poissonclj/s

(poisson lambda)

Poisson with mean λ > 0.

Poisson with mean λ > 0.
sourceraw docstring

quantileclj/s

(quantile d p)

The p-quantile of d, p in [0, 1].

The p-quantile of `d`, p in [0, 1].
sourceraw docstring

regularized-gamma-pclj/s

(regularized-gamma-p a x)

P(a, x) = γ(a, x)/Γ(a), the regularized lower incomplete gamma function.

P(a, x) = γ(a, x)/Γ(a), the regularized lower incomplete gamma function.
sourceraw docstring

regularized-gamma-qclj/s

(regularized-gamma-q a x)

Q(a, x) = 1 − P(a, x), computed directly in the upper tail.

Q(a, x) = 1 − P(a, x), computed directly in the upper tail.
sourceraw docstring

student-tclj/s

(student-t nu)
(student-t nu mu sigma)

Student's t with ν degrees of freedom, location μ and scale σ.

Student's t with ν degrees of freedom, location μ and scale σ.
sourceraw docstring

supportclj/s

(support d)

The values d can take, when finitely many (exact enumeration walks them); nil otherwise.

The values `d` can take, when finitely many (exact enumeration walks
them); nil otherwise.
sourceraw docstring

truncatedclj/s

(truncated d lo hi)

d (a univariate law with a cdf) restricted to [lo, hi] and renormalized; lo or hi may be ##-Inf / ##Inf. A discrete d lives on the integers.

`d` (a univariate law with a `cdf`) restricted to [lo, hi] and
renormalized; lo or hi may be ##-Inf / ##Inf. A discrete `d` lives on the
integers.
sourceraw docstring

uniformclj/s

(uniform a b)

Uniform on [a, b], a < b.

Uniform on [a, b], a < b.
sourceraw docstring

uniform-discreteclj/s

(uniform-discrete a b)

The integers a, a+1, …, b−1, equally likely (a < b).

The integers a, a+1, …, b−1, equally likely (a < b).
sourceraw docstring

Univariateclj/sprotocol

-cdfclj/s

(-cdf d x)

-quantileclj/s

(-quantile d p)
source

varianceclj/s

(variance d)
source

weibullclj/s

(weibull k lambda)

Weibull with shape k > 0 and scale λ > 0.

Weibull with shape k > 0 and scale λ > 0.
sourceraw docstring

zero-inflatedclj/s

(zero-inflated p-zero d)

0 with probability p-zero, otherwise a draw of d: extra zeros on top of d's own (a zero-inflated Poisson or negative binomial).

0 with probability `p-zero`, otherwise a draw of `d`: extra zeros on top
of d's own (a zero-inflated Poisson or negative binomial).
sourceraw docstring

zero-sum-normalclj/s

(zero-sum-normal sigma n)

n ≥ 2 normals of scale σ constrained to sum to zero (as PyMC's ZeroSumNormal): identifiable group offsets next to an intercept.

n ≥ 2 normals of scale σ constrained to sum to zero (as PyMC's
ZeroSumNormal): identifiable group offsets next to an intercept.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close