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.
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.
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.
| Name | Kind | Source |
|---|---|---|
AR1_KERNEL_SOURCE | Source recipe | definition |
AR1_SOURCE | Source recipe | definition |
BERNOULLI_KERNEL_SOURCE | Source recipe | definition |
BERNOULLI_LOGIT_GLM_KERNEL_SOURCE | Source recipe | definition |
BERNOULLI_LOGIT_GLM_SOURCE | Source recipe | definition |
BERNOULLI_SOURCE | Source recipe | definition |
BETA_BINOMIAL_KERNEL_SOURCE | Source recipe | definition |
BETA_BINOMIAL_SOURCE | Source recipe | definition |
BETA_KERNEL_SOURCE | Source recipe | definition |
BETA_SOURCE | Source recipe | definition |
BINOMIAL_KERNEL_SOURCE | Source recipe | definition |
BINOMIAL_SOURCE | Source recipe | definition |
CATEGORICAL_LOGIT_KERNEL_SOURCE | Source recipe | definition |
CATEGORICAL_LOGIT_REF_KERNEL_SOURCE | Source recipe | definition |
CAUCHY_LOGDENSITY | Kernel or value | definition |
CAUCHY_LOGDENSITY_SOURCE | Source recipe | definition |
DIRICHLET_KERNEL_SOURCE | Source recipe | definition |
DIRICHLET_SOURCE | Source recipe | definition |
EXPONENTIAL_KERNEL_SOURCE | Source recipe | definition |
EXPONENTIAL_SOURCE | Source recipe | definition |
GAMMA_KERNEL_SOURCE | Source recipe | definition |
GAMMA_SOURCE | Source recipe | definition |
GEOMETRIC_KERNEL_SOURCE | Source recipe | definition |
GEOMETRIC_SOURCE | Source recipe | definition |
INVERSE_GAMMA_KERNEL_SOURCE | Source recipe | definition |
INVERSE_GAMMA_SOURCE | Source recipe | definition |
LAPLACE_LOGDENSITY | Kernel or value | definition |
LKJ_CORR_CHOLESKY_KERNEL_SOURCE | Source recipe | definition |
LKJ_CORR_CHOLESKY_SOURCE | Source recipe | definition |
LOCATION_SCALE_SOURCE | Source recipe | definition |
LOGNORMAL_KERNEL_SOURCE | Source recipe | definition |
LOGNORMAL_SOURCE | Source recipe | definition |
MVNORMAL_KERNEL_SOURCE | Source recipe | definition |
MVNORMAL_SOURCE | Source recipe | definition |
NEGATIVE_BINOMIAL2_KERNEL_SOURCE | Source recipe | definition |
NEGATIVE_BINOMIAL2_SOURCE | Source recipe | definition |
NEGATIVE_BINOMIAL_KERNEL_SOURCE | Source recipe | definition |
NEGATIVE_BINOMIAL_SOURCE | Source recipe | definition |
NORMAL_ID_GLM_KERNEL_SOURCE | Source recipe | definition |
NORMAL_ID_GLM_SOURCE | Source recipe | definition |
NORMAL_LOGDENSITY | Kernel or value | definition |
NORMAL_LOGDENSITY_SOURCE | Source recipe | definition |
POISSON_KERNEL_SOURCE | Source recipe | definition |
POISSON_LOG_GLM_KERNEL_SOURCE | Source recipe | definition |
POISSON_LOG_GLM_SOURCE | Source recipe | definition |
POISSON_SOURCE | Source recipe | definition |
UNIFORM_KERNEL_SOURCE | Source recipe | definition |
UNIFORM_SOURCE | Source recipe | definition |
WEIBULL_KERNEL_SOURCE | Source recipe | definition |
WEIBULL_SOURCE | Source recipe | definition |
ZERO_INFLATED_BINOMIAL_KERNEL_SOURCE | Source recipe | definition |
ZERO_INFLATED_BINOMIAL_LOGIT_ZI_KERNEL_SOURCE | Source recipe | definition |
ZERO_INFLATED_BINOMIAL_SOURCE | Source recipe | definition |
ZERO_INFLATED_POISSON_KERNEL_SOURCE | Source recipe | definition |
ZERO_INFLATED_POISSON_SOURCE | Source recipe | definition |
ar1 | Kernel or value | definition |
bernoulli | Kernel or value | definition |
bernoulli_logit_glm | Kernel or value | definition |
bernoulli_logit_product_mixture_logdensity | Kernel or value | definition |
bernoulli_product_mixture_logdensity | Kernel or value | definition |
beta | Kernel or value | definition |
beta_binomial | Kernel or value | definition |
beta_prime | Kernel or value | definition |
binomial | Kernel or value | definition |
binomial_logit_product_mixture_logdensity | Kernel or value | definition |
binomial_product_mixture_logdensity | Kernel or value | definition |
categorical_logit | Kernel or value | definition |
categorical_logit_ref | Kernel or value | definition |
cauchy | Kernel or value | definition |
chi | Kernel or value | definition |
chi_squared | Kernel or value | definition |
dirichlet | Kernel or value | definition |
dirichlet_multinomial | Kernel or value | definition |
dirichlet_multinomial_logdensity | Kernel or value | definition |
draw_hmm_states | Function | definition |
draw_hmm_states! | Function | definition |
exponential | Kernel or value | definition |
exponential_hmm_log_weights_logdensity | Kernel or value | definition |
exponential_hmm_log_weights_state_posterior | Kernel or value | definition |
exponential_hmm_logdensity | Kernel or value | definition |
exponential_hmm_state_posterior | Kernel or value | definition |
f_dist | Kernel or value | definition |
gamma | Kernel or value | definition |
geometric | Kernel or value | definition |
gumbel | Kernel or value | definition |
hmm_log_weights_logdensity | Kernel or value | definition |
hmm_log_weights_state_posterior | Kernel or value | definition |
hmm_logdensity | Kernel or value | definition |
hmm_state_posterior | Kernel or value | definition |
hmm_state_posterior_name | Function | definition |
icar_cols_logdensity | Kernel or value | definition |
icar_logdensity | Kernel or value | definition |
icar_rows_logdensity | Kernel or value | definition |
inverse_gamma | Kernel or value | definition |
inverse_gaussian | Kernel or value | definition |
laplace | Kernel or value | definition |
lkj_corr_cholesky | Kernel or value | definition |
location_scale | Kernel or value | definition |
logistic | Kernel or value | definition |
lognormal | Kernel or value | definition |
lower_truncated_lognormal | Kernel or value | definition |
mvnormal | Kernel or value | definition |
negative_binomial | Kernel or value | definition |
negative_binomial2 | Kernel or value | definition |
normal | Kernel or value | definition |
normal_hmm_log_weights_logdensity | Kernel or value | definition |
normal_hmm_log_weights_state_posterior | Kernel or value | definition |
normal_hmm_logdensity | Kernel or value | definition |
normal_hmm_state_posterior | Kernel or value | definition |
normal_id_glm | Kernel or value | definition |
poisson | Kernel or value | definition |
poisson_log_glm | Kernel or value | definition |
product_mixture_logdensity | Kernel or value | definition |
rayleigh | Kernel or value | definition |
rk_inverse_gaussian_logtail | Function | module source |
rk_inverse_gaussian_tail | Function | module source |
rk_logprob_tail | Function | module source |
rk_ordinal_stopping_logpdf | Function | module source |
rk_ordinal_stopping_logtail | Function | module source |
rk_ordinal_stopping_tail | Function | module source |
rk_von_mises_cdf | Function | definition |
rk_von_mises_periodic_cdf | Function | module source |
standard_cauchy | Kernel or value | definition |
standard_laplace | Kernel or value | definition |
standard_logistic | Kernel or value | definition |
standard_normal | Kernel or value | definition |
standard_student_t | Kernel or value | definition |
student_t | Kernel or value | definition |
uniform | Kernel or value | definition |
upper_truncated_lognormal | Kernel or value | definition |
weibull | Kernel or value | definition |
zero_inflated_binomial | Kernel or value | definition |
zero_inflated_binomial_logit_product_mixture_logdensity | Kernel or value | definition |
zero_inflated_binomial_logit_zi | Kernel or value | definition |
zero_inflated_poisson | Kernel or value | definition |
Law reference
ReactiveKernelsDistributionKernels.DistributionKernelSources.ar1 Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.bernoulli Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.bernoulli_logit_glm Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.beta Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.beta_binomial Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.beta_prime Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.binomial Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.categorical_logit Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.categorical_logit_ref Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.cauchy Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.chi Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.chi_squared Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.dirichlet Constant
dirichlet(alpha)Dirichlet law of a probability vector x with concentrations alpha: the same law as Distributions.Dirichlet(alpha).
Endpoints: logpdf(x).
ReactiveKernelsDistributionKernels.DistributionKernelSources.dirichlet_multinomial Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.exponential Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.f_dist Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.gamma Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.geometric Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.gumbel Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.inverse_gamma Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.inverse_gaussian Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.laplace Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.lkj_corr_cholesky Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.location_scale Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.logistic Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.lognormal Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.lower_truncated_lognormal Constant
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().
ReactiveKernelsDistributionKernels.DistributionKernelSources.mvnormal Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.negative_binomial Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.negative_binomial2 Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.normal Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.normal_id_glm Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.poisson Constant
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!).
ReactiveKernelsDistributionKernels.DistributionKernelSources.poisson_log_glm Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.rayleigh Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_cauchy Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_laplace Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_logistic Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_normal Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.standard_student_t Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.student_t Constant
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.
ReactiveKernelsDistributionKernels.DistributionKernelSources.uniform Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.upper_truncated_lognormal Constant
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().
ReactiveKernelsDistributionKernels.DistributionKernelSources.weibull Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.zero_inflated_binomial Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.zero_inflated_binomial_logit_zi Constant
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).
ReactiveKernelsDistributionKernels.DistributionKernelSources.zero_inflated_poisson Constant
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).
State-path draws
ReactiveKernelsDistributionKernels.DistributionKernelSources.draw_hmm_states Method
draw_hmm_states(rng, posterior) -> Vector{Int}
draw_hmm_states!(rng, path, posterior) -> pathOne 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.