How to explain non-additive measures, Part 3: order-statistics decomposition

Interactive decomposition with atoti

This article is a part of a series. Check also: Part 1: Pro-rata allocation for a generic example of allocation into additive components and Part 2: Marginal contribution for an incremental analysis example. In this post, we’ll explore a technique which is handy for historical VaR decomposition – the “LEstimated VaR”, aka “Component VaR”.

If you wish to read what non-additive measures are and why we may want to have them decomposed – please refer to the Pro-rata allocation post

The name “LEstimated VaR” refers to the term “L-estimator” – a linear combination of order statistics – as we’ll be zooming in the tail scenario, that has been identified as the VaR scenario for the parent portfolio to break down the portfolio’s VaR into the sum of contributions by sub-portfolios.

Such contribution analysis calculations are very hard, if not impossible to do with common data aggregation tools but easy with atoti using “parent” and “sibling” data relationships which allows you to navigate any hierarchy of data and implement your on-the-fly allocation rules.

Solution #3: LEstimated VaR

In finance, the firm-level risk measure needs to be attributed down to desks in an additive manner to identify top risk drivers and allocate costs. VaR measure is non-additive, or more specifically it is sub-additive:

On the pivot table below you can see, that VaR computed at a portfolio level – Developed Markets – is smaller than the sum of sub-portfolio-level VaRs.

In this post, we create a measure – LEstimated VaR – which shows the simulated PL for the tail scenario, that has been identified as the VaR scenario for the parent Portfolio, hence allowing to break parent Portfolio’s VaR into additive risk contributions by sub-portfolios.

Python implementation

The algorithm for computing LEstimated VaR contributions is three-step:

  • identify the VaR scenario of a portfolio,
  • propagate this scenario down to the immediate children portfolios,
  • lookup simulated PL for the scenario per scenario.

To identify the VaR scenario we’ll be using atoti’s function n_lowest_indices:

# Compute the rank of the VaR scenario
vectorSize = atoti.array.len(m["Position Vector"])
m["VaR Rank Current Portfolio"] = atoti.math.floor((1 - m["Confidence Level"]) * vectorSize)

# Pick the id of the scenario at the rank
m['Tail Indices'] = atoti.array.n_lowest_indices(m["Position Vector"], m["VaR Rank Current Portfolio"])
m['VaR Scenario Id'] = m['Tail Indices'][m["VaR Rank Current Portfolio"]-1]
m['VaR Value']= m["Position Vector"][m['VaR Scenario Id']]


# Create a measure to access the parent's level Id
m['VaR Scenario Id Parent'] = atoti.parent_value(m['VaR Scenario Id'], {h["Trading Book Hierarchy"]: 1})

Having obtained the VaR scenario at the parent level, we’ll apply it to filter the historical PL vector and obtain the LEstimated VaR:

m['LEstimated VaR'] = m["Position Vector"][m['VaR Scenario Id Parent']]

Since the historical PL scenario behind the LEstimated VaR for the sub-portfolios the same as the scenario used by a portfolio’s VaR, the contributions add up exactly to the VaR value:

If a hierarchy has multiple levels – for example, as in a banks’ organizational hierarchy – the allocation of the top-level values can apply every time the user expands it.

Conclusion

In this post, we discussed how to use parent and sibling relationships in atoti to implement contributory measures and explained non-additive measures. I hope the described techniques can help solve your analytical needs.

Latest posts

Understanding Logs in Atoti
From the default log to how to configure additional logging Application logs are extremely important in any system! Most commonly, they are used to troubleshoot any issue that users may encounter while using an application. For instance, developers use them for debugging and the production support crew uses them to investigate outages. Not just that, in production, they are used to monitor an application’s performance and health. For instance, monitoring tools can pick up certain keywords to identify events such as “server down” or “system out of memory”. It can also serve as an audit trail to track user activity...
Atoti: Working with dates in Python
What is the most problematic data type you have ever dealt with when working with data? I would say dates! Depending on the locale, dates come in different formats such as YYYY-mm-dd, d/m/YYYY, d-mmm-yy etc. Not to mention, sometimes it comes with timestamps and time zones! We can let programs infer the date format or explicitly cast the data to date with a specific format e.g. in Python with Pandas DataFrame: What if we open the CSV file in Microsoft Excel, update it, and try to read it again? The above code snippet will throw out exceptions such as this:...
Understanding conditional statements in Atoti
When do we use filter, where and switch statements? We know that we can perform aggregations and multi-dimensional analysis with Atoti. Aggregation is not always as simple as 1 + 2. Sometimes we end up in an “if…else” situation, and that is where conditional statements come in. Let’s explore some examples with the XVA use case from the Atoti CE Notebook Gallery. Some definitions before moving on: Measures – we refer to metrics or quantifiable data that measure certain aspects of our goals. In the code snippets below, they are represented by measure[<name of metrics>]. Members of a level –...

Join our Community


    Like this post ? Please share

    Documentation
    Information
    Follow Us

    atoti Free Community Edition is developed and brought to you by ActiveViam. Learn more about ActiveViam at activeviam.com.