Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

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),1920)=102πeerf⁡−1(910)2\displaystyle \operatorname{cvar}\left(\operatorname{normal\_distribution}(0, 1), \frac{19}{20}\right) = \frac{10 \sqrt{2}}{\sqrt{\pi} e^{\operatorname{erf}^{-1}\left(\frac{9}{10}\right)^{2}}}
    cvar(normal_distribution(0, 1), 19/20)

    In the solver, cvar(normal_distribution(0, 1), 19/20) gives 10sqrt(2)*e^-inverse_erf(9/10)^2/sqrt(pi).

    Open in the solver
  • cvar⁡(exponential_distribution⁡(2),34)=12+ln⁡(2)\displaystyle \operatorname{cvar}\left(\operatorname{exponential\_distribution}(2), \frac{3}{4}\right) = \frac{1}{2}+\ln(2)
    cvar(exponential_distribution(2), 3/4)

    In the solver, cvar(exponential_distribution(2), 3/4) gives 1/2 + ln(2).

    Open in the solver
  • cvar⁡(uniform_distribution⁡(a,b),level⁡)=(b−a)(level⁡+1)2+a\displaystyle \operatorname{cvar}(\operatorname{uniform\_distribution}(a, b), \operatorname{level}) = \frac{(b-a) (\operatorname{level}+1)}{2}+a
    cvar(uniform_distribution(a, b), level)

    In the solver, cvar(uniform_distribution(a, b), level) gives (b - a)(level + 1)/2 + a.

    Open in the solver
  • cvar⁡([1,2,3,4],12)=72\displaystyle \operatorname{cvar}\left(\left[ 1, 2, 3, 4 \right], \frac{1}{2}\right) = \frac{7}{2}
    cvar([1, 2, 3, 4], 1/2)

    In the solver, cvar([1, 2, 3, 4], 1/2) gives 7/2.

    Open in the solver
  • cvar⁡([1,2,3,4],35)=298\displaystyle \operatorname{cvar}\left(\left[ 1, 2, 3, 4 \right], \frac{3}{5}\right) = \frac{29}{8}
    cvar([1, 2, 3, 4], 3/5)

    In the solver, cvar([1, 2, 3, 4], 3/5) gives 29/8.

    Open in the solver

Functions its examples use

  • 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.