Laplace Distribution¶
Table of contents
Density Function¶
The density function of the Laplace distribution:
Methods for scalar input, as well as for list input, are listed below.
Scalar Input¶
- pystats.dlaplace(x: float, mu: float = 0.0, sigma: float = 1.0, log: bool = False) float
Density function of the Laplace distribution.
Example
>>> pystats.dlaplace(0.7, 1.0, 2.0) 0.21517699410626442
- Parameters
x (float) – A real-valued input.
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
The density function evaluated at x.
List Input¶
- pystats.dlaplace(x: List[float], mu: float = 0.0, sigma: float = 1.0, log: bool = False) List[float]
Density function of the Laplace distribution.
Example
>>> pystats.dlaplace([0.0, 1.0, 2.0], 1.0, 2.0) [0.15163266492815836, 0.25, 0.15163266492815836]
- Parameters
x (List[float]) – A standard list input.
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
A list of density values corresponding to the elements of x.
Cumulative Distribution Function¶
The cumulative distribution function (CDF) of the Laplace distribution:
Methods for scalar input, as well as for list input, are listed below.
Scalar Input¶
- pystats.plaplace(p: float, mu: float = 0.0, sigma: float = 1.0, log: bool = False) float
Distribution function of the Laplace distribution.
Example
>>> pystats.plaplace(0.7, 1.0, 2.0) 0.4303539882125289
- Parameters
p (float) – A real-valued input.
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
The cumulative distribution function evaluated at p.
List Input¶
- pystats.plaplace(p: List[float], mu: float = 0.0, sigma: float = 1.0, log: bool = False) List[float]
Distribution function of the Laplace distribution.
Example
>>> pystats.plaplace([0.0, 1.0, 2.0], 1.0, 2.0) [0.3032653298563167, 0.5, 0.6967346701436833]
- Parameters
p (List[float]) – A standard list input.
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
log (bool) – Return the log-density or the true form.
- Returns
A list of CDF values corresponding to the elements of p.
Quantile Function¶
The quantile function of the Laplace distribution:
Methods for scalar input, as well as for list input, are listed below.
Scalar Input¶
- pystats.qlaplace(q: float, mu: float = 0.0, sigma: float = 1.0) float
Quantile function of the Laplace distribution.
Example
>>> pystats.qlaplace(0.5, 1.0, 2.0) 1.0
- Parameters
q (float) – A real-valued input.
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
- Returns
The quantile function evaluated at q.
List Input¶
- pystats.qlaplace(q: List[float], mu: float = 0.0, sigma: float = 1.0) List[float]
Quantile function of the Laplace distribution.
Example
>>> pystats.qlaplace([0.1, 0.6, 0.9], 1.0, 2.0) [-2.218875824868202, 1.4462871026284194, 4.218875824868202]
- Parameters
q (List[float]) – A standard list input.
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
- Returns
A list of quantiles values corresponding to the elements of q.
Random Sampling¶
Random sampling for the Laplace distribution is achieved via the inverse probability integral transform.
Scalar Output¶
- pystats.rlaplace(mu: float = 0.0, sigma: float = 1.0) float
Random sampling function for the Laplace distribution.
Example
>>> pystats.rlaplace(1.0, 2.0) -0.06931476521956581
- Parameters
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
- Returns
A pseudo-random draw from the Laplace distribution.
List Output¶
- pystats.rlaplace(n: int, mu: float = 0.0, sigma: float = 1.0) List[float]
Random sampling function for the Laplace distribution.
Example
>>> pystats.rlaplace(3, 1.0, 2.0) [0.7785860236771809, 0.14724988410675632, 3.0446760367044163]
- Parameters
n (int) – The number of output values.
mu (float) – The location parameter, a real-valued input.
sigma (float) – The scale parameter, a real-valued input.
- Returns
A list of pseudo-random draws from the Laplace distribution.