Supported probability distributions
Continuous random variables
We will use the following code to present a PDF and a histogram of distributions supported by the package.
This compares output of draw
and log_pdf
functions for the same distribution.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: |
|
Uniform distribution
Uniform(lower_bound, upper_bound)
signifies a uniform probability distribution on [lower_bound, upper_bound) interval.
Upper bound must be greater than lower bound.
1: 2: 3: |
|
Log-uniform distribution
Uniform(lower_bound, upper_bound)
.
A uniform distribution of log(x)
is a non-uniform for x
.
Both bounds must be greater than zero.
1: 2: 3: |
|
Linear distribution
Linear(lower_bound, upper_bound, density_at_lower_bound)
.
Density function of this distribution is linear on a [lower_bound, upper_bound) range and is 'improbable' outside of it.
Normalization condition gives us density value at upper bound: density_at_upper_bound = density_at_lower_bound + 2/(upper_bound - lower_bound).
Density must be positive on both sides which restricts their possible values.
If density_at_lower_band
is outside of the permissible range, it is brought to the nearest permissible value.
This distribution is useful as a component of Mixture
(see below).
1: 2: 3: |
|
Normal distribution
Normal(mean, standard_deviation)
. This is often used for real-valued random variables which exact distributions are not known.
1: 2: 3: |
|
Log-normal distribution
LogNormal(mean, standard_deviation_log)
. A normal distribution of log(x)
.
The second parameter is a standard deviation of log(x), not a standard deviation of x.
1: 2: 3: |
|
Exponential distribution
Exponential(mean)
describes the time between events in a process
in which events occur continuously and independently at a constant average rate.
The only parameter must be greater than zero.
Values of an exponentially distributed random variable are always greater than zero.
1: 2: 3: |
|
Gamma distribution
Gamma(alpha, beta)
- a family of distributions of positive values.
The parameters alpha and beta are sometimes called shape and rate. Both must be greater than zero.
Gamma(1, 1/lambda) === Exponential(lambda)
.
A special case of Gamma Γ(k/2, 1/2) is a chi-squared distribution χ²(k).
1: 2: 3: |
|
Descrete distributions
For these distributions draw
function always returns non-negative random values with zero fraction part.
Probability distribution function log_pdf
truncates franction part of its argument.
The only exception is Bernoulli distribution in which case log_pdf
treats all values of its argument x > 0.5
as 1
,
and the rest argument valus are treated as 0
.
The following code presents mass distribution and a histogram of
discrete probability distributions supported by the package.
This compares output of draw
and log_pdf
functions for the same distribution.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: |
|
Bernoulli
Bernoulli(mean)
denotes distribution of a yes/no experiment (1 or 0) which yields success with probability mean
.
Note that log_pdf
function returns the same value for all 'x > 0.5';
1: 2: 3: |
|
Binomial
Binomial(n, p)
is a number of successes
in a sequence of n
independent yes/no experiments, each of which yields success with probability p
.
1: 2: 3: |
|
Negative binomial distribution
NegativeBinomial(mean, r)
is a number of successes before a given number of failures r
in a sequence of yes/no experiments, each of which yields success with probability p = mean/(mean+r)
.
1: 2: 3: |
|
Poisson
Poisson(mean)
is a number of events occuring in a fixed interval of time if these events occur with a known average rate = mean
.
1: 2: 3: |
|
Mixture
Mixture([w1,d1; w2,d2; ...])
, where w1, w2, ... - weights (real numbers) and d1, d2, ... - distributions.
The list must not be empty and sum of the weights must be equal to one.
1: 2: 3: |
|
from Angara
Full name: Distributions.chart
type MT19937 =
new : copy:MT19937 -> MT19937
new : seed:uint32 [] -> MT19937
new : ?seed:uint32 -> MT19937
private new : mt:uint32 [] * idx:int -> MT19937
member bernoulli : p:float -> bool
member private getIdx : int
member private getMt : uint32 []
member get_seed : unit -> uint32 []
member normal : unit -> float
member uniform_float64 : unit -> float
...
Full name: Angara.Statistics.MT19937
--------------------
new : ?seed:uint32 -> MT19937
new : seed:uint32 [] -> MT19937
new : copy:MT19937 -> MT19937
from Microsoft.FSharp.Collections
Full name: Microsoft.FSharp.Collections.Seq.init
Full name: Angara.Statistics.draw
Full name: Angara.Statistics.histogram_
val float : value:'T -> float (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.float
--------------------
type float = System.Double
Full name: Microsoft.FSharp.Core.float
--------------------
type float<'Measure> = float
Full name: Microsoft.FSharp.Core.float<_>
from Microsoft.FSharp.Collections
Full name: Microsoft.FSharp.Collections.Array.map
Full name: Microsoft.FSharp.Core.Operators.exp
Full name: Angara.Statistics.log_pdf
{Plots: PlotInfo list;}
static member ofList : plots:PlotInfo list -> Chart
Full name: Angara.Charting.Chart
private new : unit -> Plot
static member band : seriesX:float [] * seriesY1:float [] * seriesY2:float [] * ?fill:string * ?displayName:string * ?titles:BandTitles -> PlotInfo
static member heatmap : x:float [] * y:float [] * values:float [] * ?colorPalette:string * ?treatAs:HeatmapTreatAs * ?displayName:string * ?titles:HeatmapTitles -> PlotInfo
static member heatmap : x:float [] * y:float [] * values:HeatmapValues * ?colorPalette:string * ?treatAs:HeatmapTreatAs * ?displayName:string * ?titles:HeatmapTitles -> PlotInfo
static member line : seriesY:float [] * ?stroke:string * ?thickness:float * ?treatAs:LineTreatAs * ?fill68:string * ?fill95:string * ?displayName:string * ?titles:LineTitles -> PlotInfo
static member line : seriesX:float [] * seriesY:float [] * ?stroke:string * ?thickness:float * ?treatAs:LineTreatAs * ?fill68:string * ?fill95:string * ?displayName:string * ?titles:LineTitles -> PlotInfo
static member line : x:LineX * y:LineY * ?stroke:string * ?thickness:float * ?treatAs:LineTreatAs * ?fill68:string * ?fill95:string * ?displayName:string * ?titles:LineTitles -> PlotInfo
static member markers : seriesX:float [] * seriesY:float [] * ?color:MarkersColor * ?colorPalette:string * ?size:MarkersSize * ?sizeRange:MarkersSizeRange * ?shape:MarkersShape * ?borderColor:string * ?displayName:string * ?titles:MarkersTitles -> PlotInfo
static member markers : x:MarkersX * y:MarkersY * ?color:MarkersColor * ?colorPalette:string * ?size:MarkersSize * ?sizeRange:MarkersSizeRange * ?shape:MarkersShape * ?borderColor:string * ?displayName:string * ?titles:MarkersTitles -> PlotInfo
Full name: Angara.Charting.Plot
static member Plot.line : seriesX:float [] * seriesY:float [] * ?stroke:string * ?thickness:float * ?treatAs:LineTreatAs * ?fill68:string * ?fill95:string * ?displayName:string * ?titles:LineTitles -> PlotInfo
static member Plot.line : x:LineX * y:LineY * ?stroke:string * ?thickness:float * ?treatAs:LineTreatAs * ?fill68:string * ?fill95:string * ?displayName:string * ?titles:LineTitles -> PlotInfo
Full name: Distributions.chart_uniform
Full name: Distributions.chart_loguniform
Full name: Distributions.chart_linear
Full name: Distributions.chart_normal
Full name: Distributions.chart_lognormal
Full name: Distributions.chart_exponential
Full name: Distributions.chart_gamma
Full name: Distributions.discrete_chart
Full name: Microsoft.FSharp.Collections.Array.create
val seq : sequence:seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Core.Operators.seq
--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>
Full name: Microsoft.FSharp.Collections.seq<_>
Full name: Microsoft.FSharp.Collections.Seq.iter
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
Full name: Microsoft.FSharp.Core.Operators.nan
Full name: Microsoft.FSharp.Collections.Array.mapi
Full name: Distributions.chart_bernoulli
Full name: Distributions.chart_binomial
Full name: Distributions.chart_negative_binomial
Full name: Distributions.chart_poisson
Full name: Distributions.chart_mixture