Univariate Distributions
Univariate distributions are the distributions whose variate forms are Univariate
(i.e each sample is a scalar). Abstract types for univariate distributions:
const UnivariateDistribution{S<:ValueSupport} = Distribution{Univariate,S}
const DiscreteUnivariateDistribution = Distribution{Univariate, Discrete}
const ContinuousUnivariateDistribution = Distribution{Univariate, Continuous}
Common Interface
A series of methods is implemented for each univariate distribution, which provides useful functionalities such as moment computation, pdf evaluation, and sampling (i.e. random number generation).
Parameter Retrieval
Note: params
are defined for all univariate distributions, while other parameter retrieval methods are only defined for those distributions for which these parameters make sense. See below for details.
StatsAPI.params
— Methodparams(d::UnivariateDistribution)
Return a tuple of parameters. Let d
be a distribution of type D
, then D(params(d)...)
will construct exactly the same distribution as $d$.
Distributions.scale
— Methodscale(d::UnivariateDistribution)
Get the scale parameter.
Distributions.location
— Methodlocation(d::UnivariateDistribution)
Get the location parameter.
Distributions.shape
— Methodshape(d::UnivariateDistribution)
Get the shape parameter.
Distributions.rate
— Methodrate(d::UnivariateDistribution)
Get the rate parameter.
Distributions.ncategories
— Methodncategories(d::UnivariateDistribution)
Get the number of categories.
Distributions.ntrials
— Methodntrials(d::UnivariateDistribution)
Get the number of trials.
StatsAPI.dof
— Methoddof(d::UnivariateDistribution)
Get the degrees of freedom.
For distributions for which success and failure have a meaning, the following methods are defined:
Distributions.succprob
— Methodsuccprob(d::DiscreteUnivariateDistribution)
Get the probability of success.
Distributions.failprob
— Methodfailprob(d::DiscreteUnivariateDistribution)
Get the probability of failure.
Computation of statistics
Base.maximum
— Methodmaximum(d::Distribution)
Return the maximum of the support of d
.
Base.minimum
— Methodminimum(d::Distribution)
Return the minimum of the support of d
.
Base.extrema
— Methodextrema(d::Distribution)
Return the minimum and maximum of the support of d
as a 2-tuple.
Statistics.mean
— Methodmean(d::UnivariateDistribution)
Compute the expectation.
Statistics.var
— Methodvar(d::UnivariateDistribution)
Compute the variance. (A generic std is provided as std(d) = sqrt(var(d))
)
Statistics.std
— Methodstd(d::UnivariateDistribution)
Return the standard deviation of distribution d
, i.e. sqrt(var(d))
.
Statistics.median
— Methodmedian(d::UnivariateDistribution)
Return the median value of distribution d
. The median is the smallest x
in the support of d
for which cdf(d, x) ≥ 1/2
. Corresponding to this definition as 1/2-quantile, a fallback is provided calling the quantile
function.
StatsBase.modes
— Methodmodes(d::UnivariateDistribution)
Get all modes (if this makes sense).
StatsBase.mode
— Methodmode(d::UnivariateDistribution)
Returns the first mode.
StatsBase.skewness
— Methodskewness(d::UnivariateDistribution)
Compute the skewness.
StatsBase.kurtosis
— Methodkurtosis(d::UnivariateDistribution)
Compute the excessive kurtosis.
StatsBase.kurtosis
— Methodkurtosis(d::Distribution, correction::Bool)
Computes excess kurtosis by default. Proper kurtosis can be returned with correction=false
Distributions.isplatykurtic
— Methodisplatykurtic(d)
Return whether d
is platykurtic (i.e kurtosis(d) < 0
).
Distributions.isleptokurtic
— Methodisleptokurtic(d)
Return whether d
is leptokurtic (i.e kurtosis(d) > 0
).
Distributions.ismesokurtic
— Methodismesokurtic(d)
Return whether d
is mesokurtic (i.e kurtosis(d) == 0
).
StatsBase.entropy
— Methodentropy(d::UnivariateDistribution)
Compute the entropy value of distribution d
.
StatsBase.entropy
— Methodentropy(d::UnivariateDistribution, b::Real)
Compute the entropy value of distribution d
, w.r.t. a given base.
StatsBase.entropy
— Methodentropy(d::UnivariateDistribution, b::Real)
Compute the entropy value of distribution d
, w.r.t. a given base.
Distributions.mgf
— Methodmgf(d::UnivariateDistribution, t)
Evaluate the moment-generating function of distribution d
at t
.
See also cgf
Distributions.cgf
— Methodcgf(d::UnivariateDistribution, t)
Evaluate the cumulant-generating function of distribution d
at t
.
The cumulant-generating-function is the logarithm of the moment-generating function: cgf = log ∘ mgf
. In practice, however, the right hand side may have overflow issues.
See also mgf
Distributions.cf
— Methodcf(d::UnivariateDistribution, t)
Evaluate the characteristic function of distribution d
.
Distributions.pdfsquaredL2norm
— FunctionpdfsquaredL2norm(d::Distribution)
Return the square of the L2 norm of the probability density function $f(x)$ of the distribution d
:
\[\int_{S} f(x)^{2} \mathrm{d} x\]
where $S$ is the support of $f(x)$.
Probability Evaluation
Distributions.insupport
— Methodinsupport(d::UnivariateDistribution, x::Any)
When x
is a scalar, it returns whether x is within the support of d
(e.g., insupport(d, x) = minimum(d) <= x <= maximum(d)
). When x
is an array, it returns whether every element in x is within the support of d
.
Generic fallback methods are provided, but it is often the case that insupport
can be done more efficiently, and a specialized insupport
is thus desirable. You should also override this function if the support is composed of multiple disjoint intervals.
Distributions.pdf
— Methodpdf(d::UnivariateDistribution, x::Real)
Evaluate the probability density (mass) at x
.
See also: logpdf
.
Distributions.logpdf
— Methodlogpdf(d::UnivariateDistribution, x::Real)
Evaluate the logarithm of probability density (mass) at x
.
See also: pdf
.
Missing docstring for loglikelihood(::UnivariateDistribution, ::AbstractArray)
. Check Documenter's build log for details.
Distributions.cdf
— Methodcdf(d::UnivariateDistribution, x::Real)
Evaluate the cumulative probability at x
.
Distributions.logcdf
— Methodlogcdf(d::UnivariateDistribution, x::Real)
The logarithm of the cumulative function value(s) evaluated at x
, i.e. log(cdf(x))
.
Distributions.logdiffcdf
— Methodlogdiffcdf(d::UnivariateDistribution, x::Real, y::Real)
The natural logarithm of the difference between the cumulative density function at x
and y
, i.e. log(cdf(x) - cdf(y))
.
Distributions.ccdf
— Methodccdf(d::UnivariateDistribution, x::Real)
The complementary cumulative function evaluated at x
, i.e. 1 - cdf(d, x)
.
Distributions.logccdf
— Methodlogccdf(d::UnivariateDistribution, x::Real)
The logarithm of the complementary cumulative function values evaluated at x, i.e. log(ccdf(x))
.
Statistics.quantile
— Methodquantile(d::UnivariateDistribution, q::Real)
Evaluate the (generalized) inverse cumulative distribution function at q
.
For a given 0 ≤ q ≤ 1
, quantile(d, q)
is the smallest value x
in the support of d
for which cdf(d, x) ≥ q
.
See also: cquantile
, invlogcdf
, and invlogccdf
.
Distributions.cquantile
— Methodcquantile(d::UnivariateDistribution, q::Real)
The complementary quantile value, i.e. quantile(d, 1-q)
.
Distributions.invlogcdf
— Methodinvlogcdf(d::UnivariateDistribution, lp::Real)
The (generalized) inverse function of logcdf
.
For a given lp ≤ 0
, invlogcdf(d, lp)
is the smallest value x
in the support of d
for which logcdf(d, x) ≥ lp
.
Distributions.invlogccdf
— Methodinvlogccdf(d::UnivariateDistribution, lp::Real)
The (generalized) inverse function of logccdf
.
For a given lp ≤ 0
, invlogccdf(d, lp)
is the smallest value x
in the support of d
for which logccdf(d, x) ≤ lp
.
Sampling (Random number generation)
Base.rand
— Methodrand(rng::AbstractRNG, d::UnivariateDistribution)
Generate a scalar sample from d
. The general fallback is quantile(d, rand())
.
Random.rand!
— Methodrand!(::AbstractRNG, ::Sampleable, ::AbstractArray)
Samples in-place from the sampler and stores the result in the provided array.
Continuous Distributions
Distributions.Arcsine
— TypeArcsine(a,b)
The Arcsine distribution has probability density function
\[f(x) = \frac{1}{\pi \sqrt{(x - a) (b - x)}}, \quad x \in [a, b]\]
Arcsine() # Arcsine distribution with support [0, 1]
Arcsine(b) # Arcsine distribution with support [0, b]
Arcsine(a, b) # Arcsine distribution with support [a, b]
params(d) # Get the parameters, i.e. (a, b)
minimum(d) # Get the lower bound, i.e. a
maximum(d) # Get the upper bound, i.e. b
location(d) # Get the left bound, i.e. a
scale(d) # Get the span of the support, i.e. b - a
External links
Use Arcsine(a, b, check_args=false)
to bypass argument checks.
Distributions.Beta
— TypeBeta(α, β)
The Beta distribution has probability density function
\[f(x; \alpha, \beta) = \frac{1}{B(\alpha, \beta)} x^{\alpha - 1} (1 - x)^{\beta - 1}, \quad x \in [0, 1]\]
The Beta distribution is related to the Gamma
distribution via the property that if $X \sim \operatorname{Gamma}(\alpha)$ and $Y \sim \operatorname{Gamma}(\beta)$ independently, then $X / (X + Y) \sim \operatorname{Beta}(\alpha, \beta)$.
Beta() # equivalent to Beta(1, 1)
Beta(α) # equivalent to Beta(α, α)
Beta(α, β) # Beta distribution with shape parameters α and β
params(d) # Get the parameters, i.e. (α, β)
External links
Distributions.BetaPrime
— TypeBetaPrime(α, β)
The Beta prime distribution has probability density function
\[f(x; \alpha, \beta) = \frac{1}{B(\alpha, \beta)} x^{\alpha - 1} (1 + x)^{- (\alpha + \beta)}, \quad x > 0\]
The Beta prime distribution is related to the Beta
distribution via the relationship that if $X \sim \operatorname{Beta}(\alpha, \beta)$ then $\frac{X}{1 - X} \sim \operatorname{BetaPrime}(\alpha, \beta)$
BetaPrime() # equivalent to BetaPrime(1, 1)
BetaPrime(α) # equivalent to BetaPrime(α, α)
BetaPrime(α, β) # Beta prime distribution with shape parameters α and β
params(d) # Get the parameters, i.e. (α, β)
External links
Distributions.Biweight
— TypeBiweight(μ, σ)
Distributions.Cauchy
— TypeCauchy(μ, σ)
The Cauchy distribution with location μ
and scale σ
has probability density function
\[f(x; \mu, \sigma) = \frac{1}{\pi \sigma \left(1 + \left(\frac{x - \mu}{\sigma} \right)^2 \right)}\]
Cauchy() # Standard Cauchy distribution, i.e. Cauchy(0, 1)
Cauchy(μ) # Cauchy distribution with location μ and unit scale, i.e. Cauchy(μ, 1)
Cauchy(μ, σ) # Cauchy distribution with location μ and scale σ
params(d) # Get the parameters, i.e. (μ, σ)
location(d) # Get the location parameter, i.e. μ
scale(d) # Get the scale parameter, i.e. σ
External links
Distributions.Chernoff
— TypeChernoff()
The Chernoff distribution is the distribution of the random variable
\[\underset{t \in (-\infty,\infty)}{\arg\max} ( G(t) - t^2 ),\]
where $G$ is standard two-sided Brownian motion.
The distribution arises as the limit distribution of various cube-root-n consistent estimators, including the isotonic regression estimator of Brunk, the isotonic density estimator of Grenander, the least median of squares estimator of Rousseeuw, and the maximum score estimator of Manski.
For theoretical results, see e.g. Kim and Pollard, Annals of Statistics, 1990. The code for the computation of pdf and cdf is based on the algorithm described in Groeneboom and Wellner, Journal of Computational and Graphical Statistics, 2001.
cdf(Chernoff(),-x) # For tail probabilities, use this instead of 1-cdf(Chernoff(),x)
Distributions.Chi
— TypeChi(ν)
The Chi distribution ν
degrees of freedom has probability density function
\[f(x; \nu) = \frac{1}{\Gamma(\nu/2)} 2^{1 - \nu/2} x^{\nu-1} e^{-x^2/2}, \quad x > 0\]
It is the distribution of the square-root of a Chisq
variate.
Chi(ν) # Chi distribution with ν degrees of freedom
params(d) # Get the parameters, i.e. (ν,)
dof(d) # Get the degrees of freedom, i.e. ν
External links
Distributions.Chisq
— TypeChisq(ν)
The Chi squared distribution (typically written χ²) with ν
degrees of freedom has the probability density function
\[f(x; \nu) = \frac{x^{\nu/2 - 1} e^{-x/2}}{2^{\nu/2} \Gamma(\nu/2)}, \quad x > 0.\]
If ν
is an integer, then it is the distribution of the sum of squares of ν
independent standard Normal
variates.
Chisq(ν) # Chi-squared distribution with ν degrees of freedom
params(d) # Get the parameters, i.e. (ν,)
dof(d) # Get the degrees of freedom, i.e. ν
External links
Distributions.Cosine
— TypeDistributions.Epanechnikov
— TypeEpanechnikov(μ, σ)
Distributions.Erlang
— TypeErlang(α,θ)
The Erlang distribution is a special case of a Gamma
distribution with integer shape parameter.
Erlang() # Erlang distribution with unit shape and unit scale, i.e. Erlang(1, 1)
Erlang(a) # Erlang distribution with shape parameter a and unit scale, i.e. Erlang(a, 1)
Erlang(a, s) # Erlang distribution with shape parameter a and scale s
External links
Distributions.Exponential
— TypeExponential(θ)
The Exponential distribution with scale parameter θ
has probability density function
\[f(x; \theta) = \frac{1}{\theta} e^{-\frac{x}{\theta}}, \quad x > 0\]
Exponential() # Exponential distribution with unit scale, i.e. Exponential(1)
Exponential(θ) # Exponential distribution with scale θ
params(d) # Get the parameters, i.e. (θ,)
scale(d) # Get the scale parameter, i.e. θ
rate(d) # Get the rate parameter, i.e. 1 / θ
External links
Distributions.FDist
— TypeFDist(ν1, ν2)
The F distribution has probability density function
\[f(x; \nu_1, \nu_2) = \frac{1}{x B(\nu_1/2, \nu_2/2)} \sqrt{\frac{(\nu_1 x)^{\nu_1} \cdot \nu_2^{\nu_2}}{(\nu_1 x + \nu_2)^{\nu_1 + \nu_2}}}, \quad x>0\]
It is related to the Chisq
distribution via the property that if $X_1 \sim \operatorname{Chisq}(\nu_1)$ and $X_2 \sim \operatorname{Chisq}(\nu_2)$, then $(X_1/\nu_1) / (X_2 / \nu_2) \sim \operatorname{FDist}(\nu_1, \nu_2)$.
FDist(ν1, ν2) # F-Distribution with parameters ν1 and ν2
params(d) # Get the parameters, i.e. (ν1, ν2)
External links
Distributions.Frechet
— TypeFrechet(α,θ)
The Fréchet distribution with shape α
and scale θ
has probability density function
\[f(x; \alpha, \theta) = \frac{\alpha}{\theta} \left( \frac{x}{\theta} \right)^{-\alpha-1} e^{-(x/\theta)^{-\alpha}}, \quad x > 0\]
Frechet() # Fréchet distribution with unit shape and unit scale, i.e. Frechet(1, 1)
Frechet(α) # Fréchet distribution with shape α and unit scale, i.e. Frechet(α, 1)
Frechet(α, θ) # Fréchet distribution with shape α and scale θ
params(d) # Get the parameters, i.e. (α, θ)
shape(d) # Get the shape parameter, i.e. α
scale(d) # Get the scale parameter, i.e. θ
External links
Distributions.Gamma
— TypeGamma(α,θ)
The Gamma distribution with shape parameter α
and scale θ
has probability density function
\[f(x; \alpha, \theta) = \frac{x^{\alpha-1} e^{-x/\theta}}{\Gamma(\alpha) \theta^\alpha}, \quad x > 0\]
Gamma() # Gamma distribution with unit shape and unit scale, i.e. Gamma(1, 1)
Gamma(α) # Gamma distribution with shape α and unit scale, i.e. Gamma(α, 1)
Gamma(α, θ) # Gamma distribution with shape α and scale θ
params(d) # Get the parameters, i.e. (α, θ)
shape(d) # Get the shape parameter, i.e. α
scale(d) # Get the scale parameter, i.e. θ
External links
Distributions.GeneralizedExtremeValue
— TypeGeneralizedExtremeValue(μ, σ, ξ)
The Generalized extreme value distribution with shape parameter ξ
, scale σ
and location μ
has probability density function
\[f(x; \xi, \sigma, \mu) = \begin{cases} \frac{1}{\sigma} \left[ 1+\left(\frac{x-\mu}{\sigma}\right)\xi\right]^{-1/\xi-1} \exp\left\{-\left[ 1+ \left(\frac{x-\mu}{\sigma}\right)\xi\right]^{-1/\xi} \right\} & \text{for } \xi \neq 0 \\ \frac{1}{\sigma} \exp\left\{-\frac{x-\mu}{\sigma}\right\} \exp\left\{-\exp\left[-\frac{x-\mu}{\sigma}\right]\right\} & \text{for } \xi = 0 \\ \end{cases}\]
for
\[x \in \begin{cases} \left[ \mu - \frac{\sigma}{\xi}, + \infty \right) & \text{for } \xi > 0 \\ \left( - \infty, + \infty \right) & \text{for } \xi = 0 \\ \left( - \infty, \mu - \frac{\sigma}{\xi} \right] & \text{for } \xi < 0 \end{cases}\]
GeneralizedExtremeValue(μ, σ, ξ) # Generalized Pareto distribution with shape ξ, scale σ and location μ.
params(d) # Get the parameters, i.e. (μ, σ, ξ)
location(d) # Get the location parameter, i.e. μ
scale(d) # Get the scale parameter, i.e. σ
shape(d) # Get the shape parameter, i.e. ξ (sometimes called c)
External links
Distributions.GeneralizedPareto
— TypeGeneralizedPareto(μ, σ, ξ)
The Generalized Pareto distribution (GPD) with shape parameter ξ
, scale σ
and location μ
has probability density function
\[f(x; \mu, \sigma, \xi) = \begin{cases} \frac{1}{\sigma}(1 + \xi \frac{x - \mu}{\sigma} )^{-\frac{1}{\xi} - 1} & \text{for } \xi \neq 0 \\ \frac{1}{\sigma} e^{-\frac{\left( x - \mu \right) }{\sigma}} & \text{for } \xi = 0 \end{cases}~, \quad x \in \begin{cases} \left[ \mu, \infty \right] & \text{for } \xi \geq 0 \\ \left[ \mu, \mu - \sigma / \xi \right] & \text{for } \xi < 0 \end{cases}\]
GeneralizedPareto() # GPD with unit shape and unit scale, i.e. GeneralizedPareto(0, 1, 1)
GeneralizedPareto(ξ) # GPD with shape ξ and unit scale, i.e. GeneralizedPareto(0, 1, ξ)
GeneralizedPareto(σ, ξ) # GPD with shape ξ and scale σ, i.e. GeneralizedPareto(0, σ, ξ)
GeneralizedPareto(μ, σ, ξ) # GPD with shape ξ, scale σ and location μ.
params(d) # Get the parameters, i.e. (μ, σ, ξ)
location(d) # Get the location parameter, i.e. μ
scale(d) # Get the scale parameter, i.e. σ
shape(d) # Get the shape parameter, i.e. ξ
External links
Distributions.Gumbel
— TypeGumbel(μ, θ)
The Gumbel (maxima) distribution with location μ
and scale θ
has probability density function
\[f(x; \mu, \theta) = \frac{1}{\theta} e^{-(z + e^{-z})}, \quad \text{ with } z = \frac{x - \mu}{\theta}\]
Gumbel() # Gumbel distribution with zero location and unit scale, i.e. Gumbel(0, 1)
Gumbel(μ) # Gumbel distribution with location μ and unit scale, i.e. Gumbel(μ, 1)
Gumbel(μ, θ) # Gumbel distribution with location μ and scale θ
params(d) # Get the parameters, i.e. (μ, θ)
location(d) # Get the location parameter, i.e. μ
scale(d) # Get the scale parameter, i.e. θ
External links
Distributions.InverseGamma
— TypeInverseGamma(α, θ)
The inverse Gamma distribution with shape parameter α
and scale θ
has probability density function
\[f(x; \alpha, \theta) = \frac{\theta^\alpha x^{-(\alpha + 1)}}{\Gamma(\alpha)} e^{-\frac{\theta}{x}}, \quad x > 0\]
It is related to the Gamma
distribution: if $X \sim \operatorname{Gamma}(\alpha, \beta)$, then $1 / X \sim \operatorname{InverseGamma}(\alpha, \beta^{-1})$.
InverseGamma() # Inverse Gamma distribution with unit shape and unit scale, i.e. InverseGamma(1, 1)
InverseGamma(α) # Inverse Gamma distribution with shape α and unit scale, i.e. InverseGamma(α, 1)
InverseGamma(α, θ) # Inverse Gamma distribution with shape α and scale θ
params(d) # Get the parameters, i.e. (α, θ)
shape(d) # Get the shape parameter, i.e. α
scale(d) # Get the scale parameter, i.e. θ
External links
Distributions.InverseGaussian
— TypeInverseGaussian(μ,λ)
The inverse Gaussian distribution with mean μ
and shape λ
has probability density function
\[f(x; \mu, \lambda) = \sqrt{\frac{\lambda}{2\pi x^3}} \exp\!\left(\frac{-\lambda(x-\mu)^2}{2\mu^2x}\right), \quad x > 0\]
InverseGaussian() # Inverse Gaussian distribution with unit mean and unit shape, i.e. InverseGaussian(1, 1)
InverseGaussian(μ), # Inverse Gaussian distribution with mean μ and unit shape, i.e. InverseGaussian(μ, 1)
InverseGaussian(μ, λ) # Inverse Gaussian distribution with mean μ and shape λ
params(d) # Get the parameters, i.e. (μ, λ)
mean(d) # Get the mean parameter, i.e. μ
shape(d) # Get the shape parameter, i.e. λ
External links
Distributions.JohnsonSU
— TypeJohnsonSU(ξ, λ, γ, δ)
The Johnson's $S_U$-distribution with parameters ξ, λ, γ and δ is a transformation of the normal distribution:
If
\[X = \lambda\sinh\Bigg( \frac{Z - \gamma}{\delta} \Bigg) + \xi\]
where $Z \sim \mathcal{N}(0,1)$, then $X \sim \operatorname{Johnson}(\xi, \lambda, \gamma, \delta)$.
JohnsonSU() # Equivalent to JohnsonSU(0, 1, 0, 1)
JohnsonSU(ξ, λ, γ, δ) # JohnsonSU's S_U-distribution with parameters ξ, λ, γ and δ
params(d) # Get the parameters, i.e. (ξ, λ, γ, δ)
shape(d) # Get the shape parameter, i.e. ξ
scale(d) # Get the scale parameter, i.e. λ
External links
Distributions.Kolmogorov
— TypeKolmogorov()
Kolmogorov distribution defined as
\[\sup_{t \in [0,1]} |B(t)|\]
where $B(t)$ is a Brownian bridge used in the Kolmogorov–Smirnov test for large n.
Distributions.KSDist
— TypeKSDist(n)
Distribution of the (two-sided) Kolmogorov-Smirnoff statistic
\[D_n = \sup_x | \hat{F}_n(x) -F(x)|\]
$D_n$ converges a.s. to the Kolmogorov distribution.
Distributions.KSOneSided
— TypeKSOneSided(n)
Distribution of the one-sided Kolmogorov-Smirnov test statistic:
\[D^+_n = \sup_x (\hat{F}_n(x) -F(x))\]
Distributions.Kumaraswamy
— TypeKumaraswamy(a, b)
The Kumaraswamy distribution with shape parameters a > 0
and b > 0
has probability density function
\[f(x; a, b) = a b x^{a - 1} (1 - x^a)^{b - 1}, \quad 0 < x < 1\]
It is related to the Beta distribution by the following identity: if $X \sim \operatorname{Kumaraswamy}(a, b)$ then $X^a \sim \operatorname{Beta}(1, b)$. In particular, if $X \sim \operatorname{Kumaraswamy}(1, 1)$ then $X \sim \operatorname{Uniform}(0, 1)$.
External links
References
- Kumaraswamy, P. (1980). A generalized probability density function for double-bounded random processes. Journal of Hydrology. 46(1-2), 79-88.
Distributions.Laplace
— TypeLaplace(μ,θ)
The Laplace distribution with location μ
and scale θ
has probability density function
\[f(x; \mu, \theta) = \frac{1}{2 \theta} \exp \left(- \frac{|x - \mu|}{\theta} \right)\]
Laplace() # Laplace distribution with zero location and unit scale, i.e. Laplace(0, 1)
Laplace(μ) # Laplace distribution with location μ and unit scale, i.e. Laplace(μ, 1)
Laplace(μ, θ) # Laplace distribution with location μ and scale θ
params(d) # Get the parameters, i.e., (μ, θ)
location(d) # Get the location parameter, i.e. μ
scale(d) # Get the scale parameter, i.e. θ
External links
Distributions.Levy
— TypeLevy(μ, σ)
The Lévy distribution with location μ
and scale σ
has probability density function
\[f(x; \mu, \sigma) = \sqrt{\frac{\sigma}{2 \pi (x - \mu)^3}} \exp \left( - \frac{\sigma}{2 (x - \mu)} \right), \quad x > \mu\]
Levy() # Levy distribution with zero location and unit scale, i.e. Levy(0, 1)
Levy(μ) # Levy distribution with location μ and unit scale, i.e. Levy(μ, 1)
Levy(μ, σ) # Levy distribution with location μ and scale σ
params(d) # Get the parameters, i.e. (μ, σ)
location(d) # Get the location parameter, i.e. μ
External links
Distributions.Lindley
— TypeLindley(θ)
The one-parameter Lindley distribution with shape θ > 0
has probability density function
\[f(x; \theta) = \frac{\theta^2}{1 + \theta} (1 + x) e^{-\theta x}, \quad x > 0\]
It was first described by Lindley[1] and was studied in greater detail by Ghitany et al.[2] Note that Lindley(θ)
is a mixture of an Exponential(θ)
and a Gamma(2, θ)
with respective mixing weights p = θ/(1 + θ)
and 1 - p
.
Distributions.Logistic
— TypeLogistic(μ,θ)
The Logistic distribution with location μ
and scale θ
has probability density function
\[f(x; \mu, \theta) = \frac{1}{4 \theta} \mathrm{sech}^2 \left( \frac{x - \mu}{2 \theta} \right)\]
Logistic() # Logistic distribution with zero location and unit scale, i.e. Logistic(0, 1)
Logistic(μ) # Logistic distribution with location μ and unit scale, i.e. Logistic(μ, 1)
Logistic(μ, θ) # Logistic distribution with location μ and scale θ
params(d) # Get the parameters, i.e. (μ, θ)
location(d) # Get the location parameter, i.e. μ
scale(d) # Get the scale parameter, i.e. θ
External links
Distributions.LogitNormal
— TypeLogitNormal(μ,σ)
The logit normal distribution is the distribution of of a random variable whose logit has a Normal
distribution. Or inversely, when applying the logistic function to a Normal random variable then the resulting random variable follows a logit normal distribution.
If $X \sim \operatorname{Normal}(\mu, \sigma)$ then $\operatorname{logistic}(X) \sim \operatorname{LogitNormal}(\mu,\sigma)$.
The probability density function is
\[f(x; \mu, \sigma) = \frac{1}{x \sqrt{2 \pi \sigma^2}} \exp \left( - \frac{(\text{logit}(x) - \mu)^2}{2 \sigma^2} \right), \quad x > 0\]
where the logit-Function is
\[\text{logit}(x) = \ln\left(\frac{x}{1-x}\right) \quad 0 < x < 1\]
LogitNormal() # Logit-normal distribution with zero logit-mean and unit scale
LogitNormal(μ) # Logit-normal distribution with logit-mean μ and unit scale
LogitNormal(μ, σ) # Logit-normal distribution with logit-mean μ and scale σ
params(d) # Get the parameters, i.e. (μ, σ)
median(d) # Get the median, i.e. logistic(μ)
The following properties have no analytical solution but numerical approximations. In order to avoid package dependencies for numerical optimization, they are currently not implemented.
mean(d)
var(d)
std(d)
mode(d)
Similarly, skewness, kurtosis, and entropy are not implemented.
External links
Distributions.LogNormal
— TypeLogNormal(μ,σ)
The log normal distribution is the distribution of the exponential of a Normal
variate: if $X \sim \operatorname{Normal}(\mu, \sigma)$ then $\exp(X) \sim \operatorname{LogNormal}(\mu,\sigma)$. The probability density function is
\[f(x; \mu, \sigma) = \frac{1}{x \sqrt{2 \pi \sigma^2}} \exp \left( - \frac{(\log(x) - \mu)^2}{2 \sigma^2} \right), \quad x > 0\]
LogNormal() # Log-normal distribution with zero log-mean and unit scale
LogNormal(μ) # Log-normal distribution with log-mean mu and unit scale
LogNormal(μ, σ) # Log-normal distribution with log-mean mu and scale sig
params(d) # Get the parameters, i.e. (μ, σ)
meanlogx(d) # Get the mean of log(X), i.e. μ
varlogx(d) # Get the variance of log(X), i.e. σ^2
stdlogx(d) # Get the standard deviation of log(X), i.e. σ
External links
Distributions.LogUniform
— TypeLogUniform(a,b)
A positive random variable X
is log-uniformly with parameters a
and b
if the logarithm of X
is Uniform(log(a), log(b))
. The log uniform distribution is also known as reciprocal distribution.
LogUniform(1,10)
External links
Distributions.NoncentralBeta
— TypeNoncentralBeta(α, β, λ)
Noncentral Beta distribution with shape parameters α > 0
and β > 0
and noncentrality parameter λ >= 0
.
Distributions.NoncentralChisq
— TypeNoncentralChisq(ν, λ)
The noncentral chi-squared distribution with ν
degrees of freedom and noncentrality parameter λ
has the probability density function
\[f(x; \nu, \lambda) = \frac{1}{2} e^{-(x + \lambda)/2} \left( \frac{x}{\lambda} \right)^{\nu/4-1/2} I_{\nu/2-1}(\sqrt{\lambda x}), \quad x > 0\]
It is the distribution of the sum of squares of ν
independent Normal
variates with individual means $\mu_i$ and
\[\lambda = \sum_{i=1}^\nu \mu_i^2\]
NoncentralChisq(ν, λ) # Noncentral chi-squared distribution with ν degrees of freedom and noncentrality parameter λ
params(d) # Get the parameters, i.e. (ν, λ)
External links
Distributions.NoncentralF
— TypeNoncentralF(ν1, ν2, λ)
Noncentral F-distribution with ν1 > 0
and ν2 > 0
degrees of freedom and noncentrality parameter λ >= 0
.
Distributions.NoncentralT
— TypeNoncentralT(ν, λ)
Noncentral Student's t-distribution with v > 0
degrees of freedom and noncentrality parameter λ
.