Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt

Use this file to discover all available pages before exploring further.

The percentile is a well-defined concept in the continuous case, but there are multiple ways to compute it from a discrete sample. Consider the following example. This is a plot of the 10 smallest values in a sample of 250 values drawn from the standard normal distribution. The plot shows the theoretical 2.5% quantile of the standard normal distribution (“theo”) as well as various types of 97.5 percentile estimation (floor, ceil, weighted, etc).Â
VaR Interpolation from discrete samples
Atoti Market Risk supports multiple types of VaR estimation, as described in this chapter.

Calculation steps

The algorithm can be described as follows:
  • Compute quantile as (1-confidence level)
  • Compute adjacent ranks based on the value of the level [Quantiles].[Quantiles].[QuantileName], quantile and discrete sample size
  • Sort PL and obtain PL values for the adjacent ranks and approximate VaR from the PL values using the interpolation formula controlled by the value of the level [Rounding].[RoundingMethods].[MethodName]

Computing adjacent ranks

The value of the level [Quantiles].[Quantiles].[QuantileName] is used to determine the rank calculation:
Member valueDescriptionFormula for rankExampleNotes
CenteredCorresponds to the “First variant, C=1/2” of the interpolation variants described on this wikix=quantilevectorSize+0.5x = quantile * vectorSize + 0.5(1-97.5%) x 250 + 0.5 = 6.75
Equal WeightCorresponds to the “Third variant, C=0” of the interpolation variants described on this wikix=quantile(vectorSize+1)x = quantile * (vectorSize+1)(1-97.5%)x (250+1) = 6.275default option
Exclusivex=quantile(vectorSize+1)1x = quantile * (vectorSize+1)-1(1-97.5%)x (250+1)-1 = 5.275
Simplex=quantilevectorSizex = quantile * vectorSize(1-97.5%)x 250 = 6.25
Based on the computed rank xx, we can obtain various adjacent ranks:
  • xlowerx_{lower} = rounddown(x)round_{down}(x)
  • xhigherx_{higher} = roundup(x)round_{up}(x)
  • xnearestx_{nearest} = round(x)round(x)
  • xnearestEvenx_{nearestEven} = roundtoEven(x)round_{toEven}(x)
  • weightweight = fractionalPart(x)fractionalPart(x)
and the corresponding P&L values (in the sorted P&L vector):
  • PLlowerPL_{lower} as the value of the sorted P&L vector at rank xlowerx_{lower}
  • PLhigherPL_{higher} as the value of the sorted P&L vector at rank xhigherx_{higher}
  • PLnearestPL_{nearest} as the value of the sorted P&L vector at rank xnearestx_{nearest}
  • PLnearestEvenPL_{nearestEven} as the value of the sorted P&L vector at rank xnearestEvenx_{nearestEven}

VaR approximation

The value of the level [Rounding].[RoundingMethods].[MethodName] is be used to control the interpolation.
Property valueDescriptionFormula for VaRExampleNotes
FloorSimulated PL for the lower of the adjacent ranksVaR = PLlowerPL_{lower}For xx = 6.25, the PL value at rank 6 is taken as the VaR.
CeilSimulated PL for the higher of the adjacent ranksVaR = PLhigherPL_{higher}For xx = 6.25, the PL value at rank 7 is taken as the VaR.default option
WeightedSimulated PL linearly interpolated between the adjacent ranksVaR = weightPLlower+(1weight)PLhigherweight * PL_{lower} + (1-weight) * PL_{higher}For xx = 6.25, the linear interpolation beween PL value at rank 6 and PL value at rank 7 at the point xx = 6.25 is taken as the VaR.
RoundSimulated PL for the nearest rankVaR = PLnearestPL_{nearest}For xx = 6.25, the PL value at rank 6 is taken as the VaR.
For xx = 6.75, the PL value at rank 7 is taken as the VaR.
For xx = 7.5, the PL value at rank 8 is taken as the VaR.
For xx = 8.5, the PL value at rank 9 is taken as the VaR.
For xx = 9.5, the PL value at rank 10 is taken as the VaR.
Round EvenSimulated PL for the nearest rank with rounding half to evenVaR = PLnearestEvenPL_{nearestEven}For xx = 6.25, the PL value at rank 6 is taken as the VaR.
For xx = 6.75, the PL value at rank 7 is taken as the VaR.
For xx = 7.5, the PL value at rank 8 is taken as the VaR.
For xx = 8.5, the PL value at rank 9 is taken as the VaR.
For xx = 9.5, the PL value at rank 10 is taken as the VaR.