distributions.Normal
The normal distribution, on the whole real line: asset returns, log
Usage
distributions.Normal()returns and other outcomes of either sign.
Its TVaR is mu + sigma * phi(z_p) / (1 - p) with z_p the standard normal quantile (Pricing Insurance Risk, section 4.3.3): VaR plus a multiple of sigma that depends only on p.
Parameters
mu: float-
The mean.
sigma: float- The standard deviation, positive.
Raises
Examples
>>> from prospicio.distributions import Normal
>>> x = Normal(0.0, 1.0)
>>> round(x.quantile(0.99), 6), round(x.tvar(0.99), 6)(2.326348, 2.665214)
Attributes
| Name | Description |
|---|---|
| mu | The mean. |
| sigma | The standard deviation. |
mu
The mean.
mu: float
sigma
The standard deviation.
sigma: float
Methods
| Name | Description |
|---|---|
| cdf() |
P(X <= x).
|
| mean() | The mean. |
| pdf() | The density. |
| quantile() | The quantile at p. |
| sample() |
n draws from stream stream of the generator keyed by seed.
|
| std_dev() | The standard deviation. |
| survival() |
P(X > x), precise far in the upper tail.
|
| tvar() |
Tail value at risk at p, E[X | X >= VaR(p)].
|
| variance() | The variance. |
cdf()
P(X <= x).
Usage
cdf(x)Parameters
x: float
Returns
float
mean()
The mean.
Usage
mean()Returns
float
pdf()
The density.
Usage
pdf(x)Parameters
x: float
Returns
float
quantile()
The quantile at p.
Usage
quantile(p)Parameters
p: float-
In
[0, 1].
Returns
float
sample()
Usage
sample(n, seed, stream=0)Parameters
n: intseed: intstream: int = 0
Returns
list of float
std_dev()
The standard deviation.
Usage
std_dev()Returns
float
survival()
P(X > x), precise far in the upper tail.
Usage
survival(x)Parameters
x: float
Returns
float
tvar()
Tail value at risk at p, E[X | X >= VaR(p)].
Usage
tvar(p)Parameters
p: float-
In
[0, 1).
Returns
float
variance()
The variance.
Usage
variance()Returns
float