Skip to content

Distribution kernels ​

ReactiveKernelsDistributionKernels exports the DistributionKernelSources module. Its kernel objects expose named endpoints such as logpdf, logcdf and quantile; the available endpoints depend on the distribution. These are ReactiveKernels graphs, with explicit ports for observations and parameters.

Kernel objects ​

Import the required object and call an endpoint inside an authored graph. The prepared result below is checked against Distributions at the same inputs.

julia
using ReactiveKernels
using ReactiveKernelsDistributionKernels.DistributionKernelSources: normal
using Distributions: Normal, logpdf

@kernel normal_density(x, location, scale) = begin
    density = normal(; location, scale).logpdf(x)
    return density
end
run_density = prepare(normal_density)
value = run_density(0.5, 0.0, 2.0)
reference = logpdf(Normal(0.0, 2.0), 0.5)
@assert value ≈ reference
(; value, reference)

(value = -1.643335713764618, reference = -1.643335713764618)

The endpoint is part of the enclosing graph, so preparation can select its inputs and outputs using the same boundary rules as an authored expression. The graph guide explains that selection. The conditional-latent example uses a hidden Markov density and its corresponding latent query.

Law parameters ​

Each law's docstring, listed under "Law reference" below, opens with its call signature, such as gamma(shape, rate). A positional construction binds the parameters in that order. A named construction binds any port the law lists under "Named bindings", which selects another parameterization: here the gamma law by its scale. Outside a kernel, a prepared endpoint takes the parameters first and then the endpoint's own argument.

julia
using ReactiveKernelsDistributionKernels.DistributionKernelSources: gamma
using Distributions: Gamma

@kernel gamma_by_rate(x, shape, rate) = gamma(shape, rate).logpdf(x)
@kernel gamma_by_scale(x, shape, θ) = gamma(; shape, scale = θ).logpdf(x)
by_rate = prepare(gamma_by_rate)(1.2, 2.5, 1.5)
by_scale = prepare(gamma_by_scale)(1.2, 2.5, 1 / 1.5)
outside = prepare(gamma.logpdf)(2.5, 1.5, 1.2)
reference = logpdf(Gamma(2.5, 1 / 1.5), 1.2)
@assert by_rate ≈ by_scale ≈ outside ≈ reference
(; by_rate, by_scale, outside, reference)

(by_rate = -0.797537765011576, by_scale = -0.797537765011576, outside = -0.797537765011576, reference = -0.7975377650115762)

In the REPL, ?DistributionKernelSources.gamma or @doc DistributionKernelSources.gamma shows the docstring. Base.Docs.doc(gamma) takes the value instead of the name, so it describes the object's internal type.

Exported bindings ​

The table is generated from the module loaded by this build. Source recipes are Julia source strings used by the package's development examples; prefer kernel objects and named density functions in application code. Links lead to a definition when located, or to the module's source directory, at the revision used for this build.

NameKindSource
AR1_KERNEL_SOURCESource recipedefinition
AR1_SOURCESource recipedefinition
BERNOULLI_KERNEL_SOURCESource recipedefinition
BERNOULLI_LOGIT_GLM_KERNEL_SOURCESource recipedefinition
BERNOULLI_LOGIT_GLM_SOURCESource recipedefinition
BERNOULLI_SOURCESource recipedefinition
BETA_BINOMIAL_KERNEL_SOURCESource recipedefinition
BETA_BINOMIAL_SOURCESource recipedefinition
BETA_KERNEL_SOURCESource recipedefinition
BETA_SOURCESource recipedefinition
BINOMIAL_KERNEL_SOURCESource recipedefinition
BINOMIAL_SOURCESource recipedefinition
CATEGORICAL_LOGIT_KERNEL_SOURCESource recipedefinition
CATEGORICAL_LOGIT_REF_KERNEL_SOURCESource recipedefinition
CAUCHY_LOGDENSITYKernel or valuedefinition
CAUCHY_LOGDENSITY_SOURCESource recipedefinition
DIRICHLET_KERNEL_SOURCESource recipedefinition
DIRICHLET_SOURCESource recipedefinition
EXPONENTIAL_KERNEL_SOURCESource recipedefinition
EXPONENTIAL_SOURCESource recipedefinition
GAMMA_KERNEL_SOURCESource recipedefinition
GAMMA_SOURCESource recipedefinition
GEOMETRIC_KERNEL_SOURCESource recipedefinition
GEOMETRIC_SOURCESource recipedefinition
INVERSE_GAMMA_KERNEL_SOURCESource recipedefinition
INVERSE_GAMMA_SOURCESource recipedefinition
LAPLACE_LOGDENSITYKernel or valuedefinition
LKJ_CORR_CHOLESKY_KERNEL_SOURCESource recipedefinition
LKJ_CORR_CHOLESKY_SOURCESource recipedefinition
LOCATION_SCALE_SOURCESource recipedefinition
LOGNORMAL_KERNEL_SOURCESource recipedefinition
LOGNORMAL_SOURCESource recipedefinition
MVNORMAL_KERNEL_SOURCESource recipedefinition
MVNORMAL_SOURCESource recipedefinition
NEGATIVE_BINOMIAL2_KERNEL_SOURCESource recipedefinition
NEGATIVE_BINOMIAL2_SOURCESource recipedefinition
NEGATIVE_BINOMIAL_KERNEL_SOURCESource recipedefinition
NEGATIVE_BINOMIAL_SOURCESource recipedefinition
NORMAL_ID_GLM_KERNEL_SOURCESource recipedefinition
NORMAL_ID_GLM_SOURCESource recipedefinition
NORMAL_LOGDENSITYKernel or valuedefinition
NORMAL_LOGDENSITY_SOURCESource recipedefinition
POISSON_KERNEL_SOURCESource recipedefinition
POISSON_LOG_GLM_KERNEL_SOURCESource recipedefinition
POISSON_LOG_GLM_SOURCESource recipedefinition
POISSON_SOURCESource recipedefinition
UNIFORM_KERNEL_SOURCESource recipedefinition
UNIFORM_SOURCESource recipedefinition
WEIBULL_KERNEL_SOURCESource recipedefinition
WEIBULL_SOURCESource recipedefinition
ZERO_INFLATED_BINOMIAL_KERNEL_SOURCESource recipedefinition
ZERO_INFLATED_BINOMIAL_LOGIT_ZI_KERNEL_SOURCESource recipedefinition
ZERO_INFLATED_BINOMIAL_SOURCESource recipedefinition
ZERO_INFLATED_POISSON_KERNEL_SOURCESource recipedefinition
ZERO_INFLATED_POISSON_SOURCESource recipedefinition
ar1Kernel or valuedefinition
bernoulliKernel or valuedefinition
bernoulli_logit_glmKernel or valuedefinition
bernoulli_logit_product_mixture_logdensityKernel or valuedefinition
bernoulli_product_mixture_logdensityKernel or valuedefinition
betaKernel or valuedefinition
beta_binomialKernel or valuedefinition
beta_primeKernel or valuedefinition
binomialKernel or valuedefinition
binomial_logit_product_mixture_logdensityKernel or valuedefinition
binomial_product_mixture_logdensityKernel or valuedefinition
categorical_logitKernel or valuedefinition
categorical_logit_refKernel or valuedefinition
cauchyKernel or valuedefinition
chiKernel or valuedefinition
chi_squaredKernel or valuedefinition
dirichletKernel or valuedefinition
dirichlet_multinomialKernel or valuedefinition
dirichlet_multinomial_logdensityKernel or valuedefinition
draw_hmm_statesFunctiondefinition
draw_hmm_states!Functiondefinition
exponentialKernel or valuedefinition
exponential_hmm_log_weights_logdensityKernel or valuedefinition
exponential_hmm_log_weights_state_posteriorKernel or valuedefinition
exponential_hmm_logdensityKernel or valuedefinition
exponential_hmm_state_posteriorKernel or valuedefinition
f_distKernel or valuedefinition
gammaKernel or valuedefinition
geometricKernel or valuedefinition
gumbelKernel or valuedefinition
hmm_log_weights_logdensityKernel or valuedefinition
hmm_log_weights_state_posteriorKernel or valuedefinition
hmm_logdensityKernel or valuedefinition
hmm_state_posteriorKernel or valuedefinition
hmm_state_posterior_nameFunctiondefinition
icar_cols_logdensityKernel or valuedefinition
icar_logdensityKernel or valuedefinition
icar_rows_logdensityKernel or valuedefinition
inverse_gammaKernel or valuedefinition
inverse_gaussianKernel or valuedefinition
laplaceKernel or valuedefinition
lkj_corr_choleskyKernel or valuedefinition
location_scaleKernel or valuedefinition
logisticKernel or valuedefinition
lognormalKernel or valuedefinition
lower_truncated_lognormalKernel or valuedefinition
mvnormalKernel or valuedefinition
negative_binomialKernel or valuedefinition
negative_binomial2Kernel or valuedefinition
normalKernel or valuedefinition
normal_hmm_log_weights_logdensityKernel or valuedefinition
normal_hmm_log_weights_state_posteriorKernel or valuedefinition
normal_hmm_logdensityKernel or valuedefinition
normal_hmm_state_posteriorKernel or valuedefinition
normal_id_glmKernel or valuedefinition
poissonKernel or valuedefinition
poisson_log_glmKernel or valuedefinition
product_mixture_logdensityKernel or valuedefinition
rayleighKernel or valuedefinition
rk_inverse_gaussian_logtailFunctionmodule source
rk_inverse_gaussian_tailFunctionmodule source
rk_logprob_tailFunctionmodule source
rk_ordinal_stopping_logpdfFunctionmodule source
rk_ordinal_stopping_logtailFunctionmodule source
rk_ordinal_stopping_tailFunctionmodule source
rk_von_mises_cdfFunctiondefinition
rk_von_mises_periodic_cdfFunctionmodule source
standard_cauchyKernel or valuedefinition
standard_laplaceKernel or valuedefinition
standard_logisticKernel or valuedefinition
standard_normalKernel or valuedefinition
standard_student_tKernel or valuedefinition
student_tKernel or valuedefinition
uniformKernel or valuedefinition
upper_truncated_lognormalKernel or valuedefinition
weibullKernel or valuedefinition
zero_inflated_binomialKernel or valuedefinition
zero_inflated_binomial_logit_product_mixture_logdensityKernel or valuedefinition
zero_inflated_binomial_logit_ziKernel or valuedefinition
zero_inflated_poissonKernel or valuedefinition

Law reference ​

ReactiveKernelsDistributionKernels.DistributionKernelSources.ar1 Constant
julia
ar1(μ, ϕ, scale)

Stationary first-order autoregressive normal law of a series x: x[t] - μ = ϕ * (x[t - 1] - μ) + scale * ε[t] with standard normal ε, and x[1] drawn from the stationary law, of standard deviation scale / sqrt(1 - ϕ^2). scale > 0 is the innovation standard deviation, and logpdf is -Inf unless abs(ϕ) < 1. The same law as Distributions.MvNormal with mean μ everywhere and covariance scale^2 * ϕ^abs(i - j) / (1 - ϕ^2).

Endpoints: logpdf(x).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.bernoulli Constant
julia
bernoulli(p)

Bernoulli law of a Bool outcome with success probability p: the same law as Distributions.Bernoulli(p).

Named bindings: logit, the log-odds log(p / (1 - p)), in place of p, as in bernoulli(; logit = η).logpdf(y); it stays exact where p would round to 0 or 1.

Endpoints: logpdf(observed), cdf(observed), quantile(q).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.bernoulli_logit_glm Constant
julia
bernoulli_logit_glm(X, beta)

Logistic regression law of a 0/1 vector y: y[i] is Bernoulli with success probability logistic((X * beta)[i]), so each term is a Distributions.Bernoulli log density. An intercept is a column of X.

Endpoints: logpdf(y), the summed log density; pointwise(y), the per-observation log densities; score(y), each term's derivative with respect to its linear predictor. The graph also carries eta, which is X * beta, the fitted means mu, and the working weights working_weights.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.beta Constant
julia
beta(a, b)

Beta law of x in [0, 1] with shapes a > 0 and b > 0: the same law as Distributions.Beta(a, b).

Endpoints: logpdf(x), cdf(x), ccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.beta_binomial Constant
julia
beta_binomial(n, alpha, beta)

Beta-binomial law of a count in 0:n: binomial over n trials with a success probability drawn from a beta law with shapes alpha and beta. The same law as Distributions.BetaBinomial(n, alpha, beta).

Endpoints: logpdf(observed), cdf(observed), ccdf(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.beta_prime Constant
julia
beta_prime(alpha, beta)

Beta prime law of x > 0 with shapes alpha > 0 and beta > 0, the law of y / (1 - y) for y beta-distributed with those shapes: the same law as Distributions.BetaPrime(alpha, beta).

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.binomial Constant
julia
binomial(n, p)

Binomial law of the number of successes in n trials with success probability p: the same law as Distributions.Binomial(n, p).

Named bindings: logit, the log-odds log(p / (1 - p)), in place of p.

Endpoints: logpdf(observed), cdf(observed), ccdf(observed), and the two terms whose sum is logpdf: logkernel(observed), which reads p, and lognormalizer(observed), the data-only log binomial coefficient.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.categorical_logit Constant
julia
categorical_logit(logits)

Categorical law over the classes 1:length(logits) with probabilities softmax(logits): the same law as Distributions.Categorical(LogExpFunctions.softmax(logits)).

Endpoints: logpdf(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.categorical_logit_ref Constant
julia
categorical_logit_ref(nonreference_logits)

Categorical law over the classes 1:(length(nonreference_logits) + 1) in which class 1 has logit 0 and class k > 1 has logit nonreference_logits[k - 1]: the law of categorical_logit([0.0; nonreference_logits]), without forming the padded vector.

Endpoints: logpdf(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.cauchy Constant
julia
cauchy(location, scale)

Cauchy law with location location and scale scale > 0: the same law as Distributions.Cauchy(location, scale).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized(x), which is (x - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.chi Constant
julia
chi(nu)

Chi law with nu > 0 degrees of freedom, the law of the square root of a chi-squared variable: the same law as Distributions.Chi(nu).

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.chi_squared Constant
julia
chi_squared(nu)

Chi-squared law with nu > 0 degrees of freedom, the gamma law with shape nu / 2 and rate 1 / 2: the same law as Distributions.Chisq(nu).

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.dirichlet Constant
julia
dirichlet(alpha)

Dirichlet law of a probability vector x with concentrations alpha: the same law as Distributions.Dirichlet(alpha).

Endpoints: logpdf(x).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.dirichlet_multinomial Constant
julia
dirichlet_multinomial(n, alpha)

Dirichlet-multinomial law of a vector of counts summing to n > 0, with positive concentrations alpha: the same law as Distributions.DirichletMultinomial(n, alpha). Counts that do not sum to n have log density -Inf.

Endpoints: logpdf(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.exponential Constant
julia
exponential(scale)

Exponential law of x ≥ 0 with mean scale > 0: the same law as Distributions.Exponential(scale). The parameter is a scale, not a rate: a law written with rate λ is exponential(1 / λ).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.f_dist Constant
julia
f_dist(nu1, nu2)

F law with numerator degrees of freedom nu1 > 0 and denominator degrees of freedom nu2 > 0: the same law as Distributions.FDist(nu1, nu2).

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.gamma Constant
julia
gamma(shape, rate)

Gamma law of x ≥ 0 with shape shape > 0 and rate rate > 0, so with mean shape / rate. The second parameter is a rate, not a scale: this is the same law as Distributions.Gamma(shape, 1 / rate), whose second argument is the scale.

Named bindings: scale, which is 1 / rate, or log_rate, the logarithm of rate, in place of rate, as in gamma(; shape = α, scale = θ).logpdf(x).

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.geometric Constant
julia
geometric(p)

Geometric law of the number of failures before the first success, with success probability p: the same law as Distributions.Geometric(p).

Named bindings: logitp, the log-odds log(p / (1 - p)), in place of p.

Endpoints: logpdf(observed), cdf(observed), quantile(q).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.gumbel Constant
julia
gumbel(location, scale)

Gumbel (maximum extreme value) law with location location and scale scale > 0: the same law as Distributions.Gumbel(location, scale).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized(x), which is (x - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.inverse_gamma Constant
julia
inverse_gamma(shape, scale)

Inverse-gamma law of x > 0 with shape shape > 0 and scale scale > 0: 1 / x has a gamma law with shape shape and rate scale. The same law as Distributions.InverseGamma(shape, scale).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.inverse_gaussian Constant
julia
inverse_gaussian(mu, lambda)

Inverse Gaussian law of x > 0 with mean mu > 0 and shape lambda > 0: the same law as Distributions.InverseGaussian(mu, lambda).

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.laplace Constant
julia
laplace(location, scale)

Laplace law with location location and scale scale > 0, the mean absolute deviation: the same law as Distributions.Laplace(location, scale).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized(x), which is (x - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.lkj_corr_cholesky Constant
julia
lkj_corr_cholesky(eta)

LKJ law with shape eta > 0 of the lower Cholesky factor L of a correlation matrix, Stan's lkj_corr_cholesky(eta); eta = 1 is uniform over correlation matrices. For a K × K factor it is the same law as Distributions.LKJCholesky(K, eta, 'L').

Endpoints: logpdf(L).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.location_scale Constant
julia
location_scale(standard)

Location-scale family of a parameter-free standard law. Binding the standard law, outside a kernel, gives the law of location + scale * z for z drawn from standard, with parameters (location, scale) and scale > 0. normal, cauchy, laplace and logistic are location_scale(standard_normal) and its siblings, bound once at top level; a model's own family is bound the same way, as in const my_law = location_scale(my_standard).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized(x), which is (x - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.logistic Constant
julia
logistic(location, scale)

Logistic law with location location and scale scale > 0: the same law as Distributions.Logistic(location, scale).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized(x), which is (x - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.lognormal Constant
julia
lognormal(location, scale)

Log-normal law of x > 0 whose logarithm has mean location and standard deviation scale > 0: the same law as Distributions.LogNormal(location, scale). Both parameters are on the log scale; the median is exp(location).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized_log(x), which is (log(x) - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.lower_truncated_lognormal Constant
julia
lower_truncated_lognormal(location, scale, lower)

Mean and variance of lognormal(location, scale) restricted to x ≥ lower: the moments of Distributions.truncated(Distributions.LogNormal(location, scale); lower), computed stably far into the tail. A lower that is not positive leaves the law untruncated.

Endpoints: mean(), var().

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.mvnormal Constant
julia
mvnormal(; μ, covariance)
mvnormal(; μ, chol)
mvnormal(; μ, precision)
mvnormal(; μ, precision_chol)

Multivariate normal law of a vector x with mean μ. Name the mean and one of four descriptions of the covariance: the covariance matrix covariance, its lower Cholesky factor chol (covariance = chol * chol'), the precision matrix precision (inv(covariance)), or the lower Cholesky factor precision_chol of the precision (precision = precision_chol * precision_chol'). mvnormal(; μ, covariance) is the same law as Distributions.MvNormal(μ, covariance). A positional construction would bind all five, so name the two you supply.

Named bindings: chol, precision or precision_chol in place of covariance.

Endpoints: logpdf(x).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.negative_binomial Constant
julia
negative_binomial(r, p)

Negative binomial law of the number of failures before the r-th success, with success probability p: the same law as Distributions.NegativeBinomial(r, p), and Stan's neg_binomial(r, p / (1 - p)).

Endpoints: logpdf(observed), cdf(observed), ccdf(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.negative_binomial2 Constant
julia
negative_binomial2(mu, phi)

Negative binomial law of a count with mean mu and variance mu + mu^2 / phi, Stan's neg_binomial_2(mu, phi): the same law as Distributions.NegativeBinomial(phi, phi / (mu + phi)).

Endpoints: logpdf(observed), cdf(observed), ccdf(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.normal Constant
julia
normal(location, scale)

Normal law with mean location and standard deviation scale > 0: the same law as Distributions.Normal(location, scale).

Named bindings: log_scale, the logarithm of scale, in place of scale, as in normal(; location = μ, log_scale = log_σ).logpdf(x).

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized(x), which is (x - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.normal_id_glm Constant
julia
normal_id_glm(X, beta, sigma)

Identity-link normal regression law of a vector y: y[i] is normal with mean (X * beta)[i] and standard deviation sigma > 0, so each term is a Distributions.Normal log density. An intercept is a column of X.

Endpoints: logpdf(y), the summed log density; pointwise(y), the per-observation log densities; score(y), each term's derivative with respect to its mean. The graph also carries eta, which is X * beta, and mu, the same values.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.poisson Constant
julia
poisson(rate)

Poisson law of a count with mean rate > 0: the same law as Distributions.Poisson(rate).

Named bindings: log_rate, the logarithm of rate, in place of rate, as in poisson(; log_rate = η).logpdf(y) for a log link.

Endpoints: logpdf(observed), cdf(observed), ccdf(observed), and the two terms whose sum is logpdf: logkernel(observed), which reads the rate, and lognormalizer(observed), the data-only -log(observed!).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.poisson_log_glm Constant
julia
poisson_log_glm(X, beta)

Log-link Poisson regression law of a count vector y: y[i] is Poisson with mean exp((X * beta)[i]), so each term is a Distributions.Poisson log density. An intercept is a column of X.

Endpoints: logpdf(y), the summed log density; pointwise(y), the per-observation log densities, the sum of logkernel(y), the terms that read the linear predictor, and lognormalizer(y), the data-only -loggamma.(y .+ 1); score(y), each term's derivative with respect to its linear predictor. The graph also carries eta, which is X * beta, the fitted means mu, and the working weights working_weights.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.rayleigh Constant
julia
rayleigh(scale)

Rayleigh law of x ≥ 0 with scale scale > 0: the same law as Distributions.Rayleigh(scale).

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_cauchy Constant
julia
standard_cauchy()

Standard Cauchy law: the same law as Distributions.Cauchy(). It has no parameters, so its endpoints are called directly, as in standard_cauchy.logpdf(z).

Endpoints: logpdf(z), cdf(z), ccdf(z), logcdf(z), logccdf(z), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_laplace Constant
julia
standard_laplace()

Standard Laplace law, with density exp(-abs(z)) / 2: the same law as Distributions.Laplace(). It has no parameters, so its endpoints are called directly, as in standard_laplace.logpdf(z).

Endpoints: logpdf(z), cdf(z), ccdf(z), logcdf(z), logccdf(z), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_logistic Constant
julia
standard_logistic()

Standard logistic law, whose CDF is the logistic sigmoid: the same law as Distributions.Logistic(). It has no parameters, so its endpoints are called directly, as in standard_logistic.logpdf(z).

Endpoints: logpdf(z), cdf(z), ccdf(z), logcdf(z), logccdf(z), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_normal Constant
julia
standard_normal()

Standard normal law: the same law as Distributions.Normal(). It has no parameters, so its endpoints are called directly, as in standard_normal.logpdf(z).

Endpoints: logpdf(z), cdf(z), ccdf(z), logcdf(z), logccdf(z), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_student_t Constant
julia
standard_student_t(nu)

Student-t law with nu > 0 degrees of freedom, location 0 and scale 1: the same law as Distributions.TDist(nu). nu = Inf gives the standard normal law.

Endpoints: logpdf(z), cdf(z), ccdf(z), logcdf(z), logccdf(z), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.student_t Constant
julia
student_t(nu, location, scale)

Student-t law with nu > 0 degrees of freedom, location location and scale scale > 0: the law of location + scale * t for t drawn from Distributions.TDist(nu), which Distributions.jl writes Distributions.TDist(nu) * scale + location. The degrees of freedom come first. scale is not the standard deviation, which is scale * sqrt(nu / (nu - 2)) for nu > 2.

Named bindings: log_scale, the logarithm of scale, in place of scale.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p), and standardized(x), which is (x - location) / scale.

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.uniform Constant
julia
uniform(lower, upper)

Continuous uniform law on [lower, upper], with lower < upper: the same law as Distributions.Uniform(lower, upper).

Endpoints: logpdf(x), cdf(x), ccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.upper_truncated_lognormal Constant
julia
upper_truncated_lognormal(location, scale, upper)

Mean and variance of lognormal(location, scale) restricted to x ≤ upper: the moments of Distributions.truncated(Distributions.LogNormal(location, scale); upper), computed stably far into the tail. An infinite upper leaves the law untruncated; one that is not positive gives NaN.

Endpoints: mean(), var().

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.weibull Constant
julia
weibull(k, theta)

Weibull law of x ≥ 0 with shape k > 0 and scale theta > 0: the same law as Distributions.Weibull(k, theta).

Named bindings: log_theta, the logarithm of theta, in place of theta.

Endpoints: logpdf(x), cdf(x), ccdf(x), logcdf(x), logccdf(x), quantile(p).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.zero_inflated_binomial Constant
julia
zero_inflated_binomial(n, p, zi)

Zero-inflated binomial law of a count: a structural zero with probability zi, otherwise a binomial count over n trials with success probability p. The same law as Distributions.MixtureModel([Distributions.Dirac(0), Distributions.Binomial(n, p)], [zi, 1 - zi]).

Named bindings: logit, the log-odds log(p / (1 - p)), in place of p.

Endpoints: logpdf(observed), cdf(observed), ccdf(observed), logkernel(observed), lognormalizer(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.zero_inflated_binomial_logit_zi Constant
julia
zero_inflated_binomial_logit_zi(n, p, zi_logit)

The law of zero_inflated_binomial(n, p, zi) with the zero-inflation probability given by its log-odds: zero_inflated_binomial(n, p, 1 / (1 + exp(-zi_logit))), without forming a rounded zi.

Named bindings: logit, the log-odds log(p / (1 - p)), in place of p.

Endpoints: logpdf(observed), logkernel(observed), lognormalizer(observed).

source
ReactiveKernelsDistributionKernels.DistributionKernelSources.zero_inflated_poisson Constant
julia
zero_inflated_poisson(rate, zi)

Zero-inflated Poisson law of a count: a structural zero with probability zi, otherwise a Poisson count with mean rate. The same law as Distributions.MixtureModel([Distributions.Dirac(0), Distributions.Poisson(rate)], [zi, 1 - zi]).

Named bindings: log_rate, the logarithm of rate, in place of rate.

Endpoints: logpdf(observed), cdf(observed), ccdf(observed).

source

State-path draws ​

ReactiveKernelsDistributionKernels.DistributionKernelSources.draw_hmm_states Method
julia
draw_hmm_states(rng, posterior) -> Vector{Int}
draw_hmm_states!(rng, path, posterior) -> path

One exact draw of a hidden Markov law's state path from its posterior, the value of the law's state-posterior twin (normal_hmm_state_posterior and so on). The last state is drawn from its filtered probabilities, then each earlier state given its successor, from the filtered probabilities weighed by the move into that successor (forward filtering, backward sampling). Only rng supplies randomness, so a seeded rng reproduces the path. Throws an ArgumentError when the observations are impossible under every path.

source