cvar function
The conditional value at risk of a loss: its expected value over the worst share 1 - level.
How to write it
cvar(distribution, level)
The expected loss in the worst share 1 - level: the mean of quantile(distribution, u) for u from level to 1.
- distribution
- The law of the loss: a normal, lognormal, uniform, exponential or Weibull one. Takes an expression.
- level
- The level, a number above 0 and below 1 such as 19/20, or a symbol. Takes an expression.
cvar(data, level)
The mean of the worst share 1 - level of the losses, with the part of a scenario that the share ends in.
- data
- The losses, as scenarios that are equally likely. They are put in order, so symbols are not allowed. Takes a list.
- level
- The level, from 0 to 1: 0 gives the mean and 1 the largest loss. Takes a number.
Examples
cvar(normal_distribution(0, 1), 19/20)In the solver,
Open in the solvercvar(normal_distribution(0, 1), 19/20)gives10sqrt(2)*e^-inverse_erf(9/10)^2/sqrt(pi).cvar(exponential_distribution(2), 3/4)In the solver,
Open in the solvercvar(exponential_distribution(2), 3/4)gives1/2 + ln(2).cvar(uniform_distribution(a, b), level)In the solver,
Open in the solvercvar(uniform_distribution(a, b), level)gives(b - a)(level + 1)/2 + a.cvar([1, 2, 3, 4], 1/2)In the solver,
Open in the solvercvar([1, 2, 3, 4], 1/2)gives7/2.cvar([1, 2, 3, 4], 3/5)In the solver,
Open in the solvercvar([1, 2, 3, 4], 3/5)gives29/8.
Functions its examples use
- normal_distribution
The normal distribution with mean mu and standard deviation sigma.
- exponential_distribution
The waiting time for events that come at rate lambda.
- uniform_distribution
The continuous distribution that is equally likely anywhere between a and b.
Related functions
- distributed
A variable and the distribution it follows, as probability and expectation read it.
- covariance
The sample covariance of two lists of the same length.
- expectation
The expected value of an expression of a variable with a distribution or a process.
- correlation
The correlation coefficient of two lists of the same length.
- cdf
The probability that a variable with a distribution is at most a value.
- fit
The least-squares fit of a combination of functions through points.