Skip to main content

distributions.Normal

The normal distribution, on the whole real line: asset returns, log

Usage

Source

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

ValueError
If mu is not finite or sigma not finite and positive.

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

Source

cdf(x)
Parameters
x: float
Returns
float

mean()

The mean.

Usage

Source

mean()
Returns
float

pdf()

The density.

Usage

Source

pdf(x)
Parameters
x: float
Returns
float

quantile()

The quantile at p.

Usage

Source

quantile(p)
Parameters
p: float
In [0, 1].
Returns
float

sample()

n draws from stream stream of the generator keyed by seed.

Usage

Source

sample(n, seed, stream=0)
Parameters
n: int
seed: int
stream: int = 0
Returns
list of float

std_dev()

The standard deviation.

Usage

Source

std_dev()
Returns
float

survival()

P(X > x), precise far in the upper tail.

Usage

Source

survival(x)
Parameters
x: float
Returns
float

tvar()

Tail value at risk at p, E[X | X >= VaR(p)].

Usage

Source

tvar(p)
Parameters
p: float
In [0, 1).
Returns
float

variance()

The variance.

Usage

Source

variance()
Returns
float