Distributions

Functions for probability distributions and draws.

biogeme.distributions module

Implementation of the pdf and CDF of common distributions

author

Michel Bierlaire

date

Thu Apr 23 12:01:49 2015

biogeme.distributions.logisticcdf(x, mu=`0.0`, s=`1.0`)[source]

Logistic CDF

Cumulative distribution function of a logistic distribution

\[f(x;\mu, \sigma) = \frac{1} {1+\exp\left(-\frac{x-\mu}{\sigma} \right)}\]
Parameters
  • x (float or biogeme.expression) – value at which the CDF is evaluated.

  • mu (float or biogeme.expression) – location parameter \(\mu\) of the logistic distribution. Default: 0.

  • s (float or biogeme.expression) – scale parameter \(\sigma\) of the logistic distribution. Default: 1.

Note

It is assumed that \(\sigma > 0\), but it is not verified by the code.

Returns

value of the logistic CDF.

Return type

float or biogeme.expression

biogeme.distributions.lognormalpdf(x, mu=0.0, s=1.0)[source]

Log normal pdf

Probability density function of a log normal distribution

\[f(x;\mu, \sigma) = \frac{1}{x\sigma \sqrt{2\pi}} \exp{-\frac{(\ln x-\mu)^2}{2\sigma^2}}\]
Parameters
  • x (float or biogeme.expression) – value at which the pdf is evaluated.

  • mu (float or biogeme.expression) – location parameter \(\mu\) of the lognormal distribution. Default: 0.

  • s (float or biogeme.expression) – scale parameter \(\sigma\) of the lognormal distribution. Default: 1.

Note

It is assumed that \(\sigma > 0\), but it is not verified by the code.

Returns

value of the lognormal pdf.

Return type

float or biogeme.expression

biogeme.distributions.normalpdf(x, mu=`0.0`, s=`1.0`)[source]

Normal pdf

Probability density function of a normal distribution

\[f(x;\mu, \sigma) = \frac{1}{\sigma \sqrt{2\pi}} \exp{-\frac{(x-\mu)^2}{2\sigma^2}}\]
Parameters
  • x (float or biogeme.expression) – value at which the pdf is evaluated.

  • mu (float or biogeme.expression) – location parameter \(\mu\) of the Normal distribution. Default: 0.

  • s (float or biogeme.expression) – scale parameter \(\sigma\) of the Normal distribution. Default: 1.

Note

It is assumed that \(\sigma > 0\), but it is not verified by the code.

Returns

value of the Normal pdf.

Return type

float or biogeme.expression

biogeme.distributions.triangularpdf(x, a=-1.0, b=1.0, c=0.0)[source]

Triangular pdf

Probability density function of a triangular distribution

\[\begin{split}f(x;a, b, c) = \left\{ \begin{array}{ll} 0 & \text{if } x < a \\\frac{2(x-a)}{(b-a)(c-a)} & \text{if } a \leq x < c \\\frac{2(b-x)}{(b-a)(b-c)} & \text{if } c \leq x < b \\0 & \text{if } x \geq b. \end{array} \right.\end{split}\]
Parameters
  • x (float or biogeme.expression) – argument of the pdf

  • a (float or biogeme.expression) – lower bound \(a\) of the distribution. Default: -1.

  • b (float or biogeme.expression) – upper bound \(b\) of the distribution. Default: 1.

  • c (float or biogeme.expression) – mode \(c\) of the distribution. Default: 0.

Note

It is assumed that \(a < c < b\), but it is not verified by the code.

Returns

value of the triangular pdf.

Return type

float or biogeme.expression

biogeme.distributions.uniformpdf(x, a=-1, b=1.0)[source]

Uniform pdf

Probability density function of a uniform distribution.

\[\begin{split}f(x;a, b) = \left\{ \begin{array}{ll} \frac{1}{b-a} & \text{for } x \in [a, b] \\ 0 & \text{otherwise}\end{array} \right.\end{split}\]
Parameters
  • x (float or biogeme.expression) – argument of the pdf

  • a (float or biogeme.expression) – lower bound \(a\) of the distribution. Default: -1.

  • b (float or biogeme.expression) – upper bound \(b\) of the distribution. Default: 1.

Note

It is assumed that \(a < b\), but it is not verified by the code.

Returns

value of the uniform pdf.

Return type

float or biogeme.expression