distributions.Sampled
A distribution known only through equally weighted draws.
Usage
distributions.Sampled()Parameters
draws: list of float- Non-empty, all finite.
Raises
ValueError- If draws is empty or holds a value that is not finite.
Examples
>>> from prospicio.distributions import Sampled
>>> s = Sampled([1.0, 2.0, 3.0, 4.0])
>>> s.tvar(0.5)3.5
Attributes
| Name | Description |
|---|---|
| draws | The draws, in simulation order. |
draws
The draws, in simulation order.
draws: list[float]
Methods
| Name | Description |
|---|---|
| cdf() |
Empirical distribution function P(X <= x).
|
| mean() | Mean of the draws. |
| quantile() |
Inverted empirical cdf (R type = 1).
|
| tvar() |
Tail value at risk at level p: the mean of the worst 1 - p.
|
| var() | Value at risk at level p. |
| variance() | Variance of the draws (dividing by n). |
cdf()
Empirical distribution function P(X <= x).
Usage
cdf(x)Parameters
x: float
Returns
float
mean()
Mean of the draws.
Usage
mean()Returns
float
quantile()
Inverted empirical cdf (R type = 1).
Usage
quantile(p)Parameters
p: float
Returns
float
Raises
ValueError-
If p is outside
[0, 1].
tvar()
Tail value at risk at level p: the mean of the worst 1 - p.
Usage
tvar(p)Parameters
p: float
Returns
float
Raises
ValueError-
If p is outside
[0, 1].
var()
Value at risk at level p.
Usage
var(p)Parameters
p: float
Returns
float
Raises
ValueError-
If p is outside
[0, 1].
variance()
Variance of the draws (dividing by n).
Usage
variance()Returns
float