ContinuousDistribution

Common interface for continuous probability distributions.

A continuous distribution assigns probabilities to intervals of real numbers via a probability density function (PDF). Implementations provide methods to evaluate the density, log-density, cumulative probability, quantiles, and random sampling.

Extends Distribution, which provides shared statistical properties such as mean, variance, standardDeviation, skewness, kurtosis, and the sf survival function.

Example:

val dist: ContinuousDistribution = NormalDistribution(mu = 0.0, sigma = 1.0)
dist.pdf(0.0) // 0.3989... (peak density at the mean)
dist.logPdf(0.0) // -0.9189... (log of the density)
dist.cdf(1.96) // 0.975... (area under the curve up to 1.96)
dist.quantile(0.975) // 1.96 (inverse of cdf)
dist.sample(Random(42)) // a single random draw
dist.sample(5, Random(42)) // five random draws

See also

for inherited statistical properties and survival function.

Inheritors

Properties

Link copied to clipboard
open override val entropy: Double

Returns the Shannon entropy of this distribution in nats (natural logarithm units).

Functions

Link copied to clipboard
abstract override fun cdf(x: Double): Double

Returns the cumulative distribution function (CDF) value at x.

Link copied to clipboard
abstract fun logPdf(x: Double): Double

Returns the natural logarithm of the probability density at x.

Link copied to clipboard
abstract fun pdf(x: Double): Double

Returns the probability density at x.

Link copied to clipboard
abstract override fun quantile(p: Double): Double

Returns the quantile (inverse CDF) for the given probability p.

Link copied to clipboard
abstract fun sample(random: Random): Double

Draws a single random value from this distribution.

open fun sample(n: Int, random: Random): DoubleArray

Draws n independent random values from this distribution.