Skip to main content

Rearrangement Algorithm

PyPI version Read the docs status

Python implementation of a rearrangement algorithm that can be used to calculate bounds on the value-at-risk (VaR) of dependent risks.

The current version includes the following calculations:

  • Upper and lower bounds on the VaR of dependent risks1
  • Upper and lower bounds on the survival probability of functions of dependent risks2
  • Upper and lower bounds on the expected value of supermodular functions of dependent risks3

Mathematical Background

Mathematical details and derivations can be found in the publications123.

More information and an overview of extensions can be found on the website of the Rearrangement Algorithm project.

Implementation

Parts of this implementation are based on the qrmtools R package (version 0.0-13) by M. Hofert, K. Hornik, and A. J. McNeil. Details on the algorithm and the R implementation can be found in the paper "Implementing the Rearrangement Algorithm: An Example from Computational Risk Management", M. Hofert, In: Risks, vol. 8, no. 2, 20204.

Installation

You can install the package via pip

pip install rearrangement-algorithm

If you want to install the latest (unstable) version, you can install the package from source

git clone https://gitlab.com/klb2/rearrangement-algorithm.git
cd rearrangement-algorithm
git checkout dev
pip install .

Documentation

You can find the documentation for this package on Read the Docs.
This also includes some usage examples.

License and Referencing

This program is licensed under the GPLv3 license. If you in any way use this code for research that results in publications, please cite this package.

Parts of this code are based on the qrmtools R package (version 0.0-13), which is also released under the GPLv3 license.

References

  1. P. Embrechts, G. Puccetti, and L. Rüschendorf, "Model uncertainty and VaR aggregation," J. Bank. Financ., vol. 37, no. 8, pp. 2750-2764, Aug. 2013. doi:10.1016/j.jbankfin.2013.03.014 ↩ ↩2

  2. G. Puccetti and L. Rüschendorf, "Computation of sharp bounds on the distribution of a function of dependent risks," J. Comput. Appl. Math., vol. 236, no. 7, pp. 1833-1840, Jan. 2012. doi:10.1016/j.cam.2011.10.015 ↩ ↩2

  3. G. Puccetti and L. Rüschendorf, "Computation of Sharp Bounds on the Expected Value of a Supermodular Function of Risks with Given Marginals," Commun. Stat. - Simul. Comput., vol. 44, no. 3, pp. 705-718, Mar. 2015. doi:10.1080/03610918.2013.791368 ↩ ↩2

  4. M. Hofert, "Implementing the Rearrangement Algorithm: An Example from Computational Risk Management," Risks, vol. 8, no. 2, May 2020. doi:10.3390/risks8020047 ↩

Metadata

Release files for rearrangement-algorithm 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rearrangement-algorithm 0.1.1
File Size Uploaded
rearrangement_algorithm-0.1.1.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rearrangement-algorithm 0.1.1
File Interpreter ABI Platform
rearrangement_algorithm-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.1 kB

Release files / rearrangement_algorithm-0.1.1.tar.gz

Download URL rearrangement_algorithm-0.1.1.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
65d287258920b944d66d7c259a32999465fcc5e1fbbf8284046d09747a50d1f2
BLAKE2b-256 checksum
How to use checksums
489fb1015f1b71bd171cb10a1fab7a70ad6e76442c8282414dc6c67d04b8dfde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.7

Release files / rearrangement_algorithm-0.1.1-py3-none-any.whl

Download URL rearrangement_algorithm-0.1.1-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2fce82a749bb03234ac7717058518d83f304676e8f23c1dcd4917448faec1c5
BLAKE2b-256 checksum
How to use checksums
2bdce726b927ee7935261f8536d78a4773fef0717cfe5c3d3a841d6fac2b105f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.6.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page