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 (Union[float, Expression]) – value at which the CDF is evaluated.

  • mu (Union[float, Expression]) – location parameter \(\mu\) of the logistic distribution. Default: 0.

  • s (Union[float, 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.

Return type:

Expression

Returns:

value of the logistic CDF.

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 (Union[float, Expression]) – value at which the pdf is evaluated.

  • mu (Union[float, Expression]) – location parameter \(\mu\) of the lognormal distribution.

  • s (Union[float, Expression]) – scale parameter \(\sigma\) of the lognormal distribution.

Note:

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

Return type:

Expression

Returns:

value of the lognormal pdf.

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 (Union[float, Expression]) – value at which the pdf is evaluated.

  • mu (Union[float, Expression]) – location parameter \(\mu\) of the Normal distribution.

  • s (Union[float, Expression]) – scale parameter \(\sigma\) of the Normal distribution.

Note:

It is assumed that \(\sigma > 0\).

Return type:

Expression

Returns:

value of the Normal pdf.

Raises:

ValueError – if \(\sigma \leq 0\).

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 (Union[float, Expression]) – argument of the pdf

  • a (Union[float, Expression]) – lower bound \(a\) of the distribution. Default: -1.

  • b (Union[float, Expression]) – upper bound \(b\) of the distribution. Default: 1.

  • c (Union[float, Expression]) – mode \(c\) of the distribution. Default: 0.

Note:

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

Return type:

Expression

Returns:

value of the triangular pdf.

biogeme.distributions.uniformpdf(x, a=`-1.0`, 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 (Union[float, Expression]) – argument of the pdf

  • a (Union[float, Expression]) – lower bound \(a\) of the distribution. Default: -1.

  • b (Union[float, Expression]) – upper bound \(b\) of the distribution. Default: 1.

Note:

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

Return type:

Expression

Returns:

value of the uniform pdf.