LaplaceDistribution

class LaplaceDistribution(val mu: Double = 0.0, val scale: Double = 1.0) : ContinuousDistribution(source)

Represents the Laplace distribution (also known as the double exponential distribution), defined by its location mu and scale parameters.

The Laplace distribution is a symmetric, peaked distribution centered at mu with exponentially decaying tails on both sides. Compared to the normal distribution with the same variance, the Laplace has a sharper peak at the center and heavier tails, meaning extreme values are more likely. This makes it useful in robust statistics where outliers are common, in signal processing for modeling Laplacian noise, and in Bayesian inference as a sparsity-promoting prior (the Lasso penalty in regression corresponds to a Laplace prior). The support is the entire real line.

Example:

val dist = LaplaceDistribution(mu = 0.0, scale = 1.0)
dist.pdf(0.0) // 0.5 (peak density at the center)
dist.cdf(0.0) // 0.5 (symmetric around mu)
dist.quantile(0.75) // 0.6931... (third quartile)
dist.mean // 0.0
dist.variance // 2.0

Constructors

Link copied to clipboard
constructor(mu: Double = 0.0, scale: Double = 1.0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val entropy: Double

The Shannon entropy of this distribution in nats, equal to 1 + ln(2 * scale).

Link copied to clipboard
open override val kurtosis: Double

The excess kurtosis of this distribution, always 3.0 (leptokurtic, heavier tails than normal).

Link copied to clipboard
open override val mean: Double

The mean of this distribution, equal to mu.

Link copied to clipboard
val mu: Double

the location parameter (center and mode) of the distribution. Defaults to 0.0.

Link copied to clipboard

the scale parameter controlling the spread. Must be positive. Defaults to 1.0. Larger values produce wider, flatter distributions.

Link copied to clipboard
open override val skewness: Double

The skewness of this distribution, always zero due to symmetry around mu.

Link copied to clipboard
open override val standardDeviation: Double

The standard deviation of this distribution, equal to scale * sqrt(2).

Link copied to clipboard
open override val variance: Double

The variance of this distribution, equal to 2 * scale^2.

Functions

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

Returns the cumulative distribution function value at x for this Laplace distribution.

Link copied to clipboard
open override fun logPdf(x: Double): Double

Returns the natural logarithm of the probability density at x for this Laplace distribution.

Link copied to clipboard
open override fun pdf(x: Double): Double

Returns the probability density at x for this Laplace distribution.

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

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

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

Draws a single random value from this Laplace distribution using inverse CDF sampling.

Link copied to clipboard
open override fun sf(x: Double): Double

Returns the survival function value at x for this Laplace distribution.