scieee AI-readable full text Open interactive document viewer

Implementing the rearrangement algorithm: An example from computational risk management

Hofert, Marius

Abstract

EconStor is a publication server for scholarly economic literature, provided as a non-commercial public service by the ZBW.

Full text

Hofert, Marius Article Implementing the rearrangement algorithm: An example from computational risk management Risks Provided in Cooperation with: MDPI – Multidisciplinary Digital Publishing Institute, Basel Suggested Citation: Hofert, Marius (2020) : Implementing the rearrangement algorithm: An example from computational risk management, Risks, ISSN 2227-9091, MDPI, Basel, Vol. 8, Iss. 2, pp. 1-28, https://doi.org/10.3390/risks8020047 This Version is available at: https://hdl.handle.net/10419/258001 Standard-Nutzungsbedingungen: Die Dokumente auf EconStor dürfen zu eigenen wissenschaftlichen Zwecken und zum Privatgebrauch gespeichert und kopiert werden. Sie dürfen die Dokumente nicht für öffentliche oder kommerzielle Zwecke vervielfältigen, öffentlich ausstellen, öffentlich zugänglich machen, vertreiben oder anderweitig nutzen. Sofern die Verfasser die Dokumente unter Open-Content-Lizenzen (insbesondere CC-Lizenzen) zur Verfügung gestellt haben sollten, gelten abweichend von diesen Nutzungsbedingungen die in der dort genannten Lizenz gewährten Nutzungsrechte. Terms of use: Documents in EconStor may be saved and copied for your personal and scholarly purposes. You are not to copy documents for public or commercial purposes, to exhibit the documents publicly, to make them publicly available on the internet, or to distribute or otherwise use the documents in public. If the documents have been made available under an Open Content Licence (especially Creative Commons Licences), you may exercise further usage rights as specified in the indicated licence. https://creativecommons.org/licenses/by/4.0/ risks Article Implementing the Rearrangement Algorithm: An Example from Computational Risk Management Marius Hofert Department of Statistics and Actuarial Science, University of Waterloo, 200 University Avenue West, Waterloo, ON N2L 3G1, Canada; [email protected] Received: 20 April 2020; Accepted: 8 May 2020; Published: 14 May 2020   Abstract: After a brief overview of aspects of computational risk management, the implementation of the rearrangement algorithm in Ris considered as an example from computational risk management practice. This algorithm is used to compute the largest quantile (worst value-at-risk) of the sum of the components of a random vector with specified marginal distributions. It is demonstrated how a basic implementation of the rearrangement algorithm can gradually be improved to provide a fast and reliable computational solution to the problem of computing worst value-at-risk. Besides a running example, an example based on real-life data is considered. Bootstrap confidence intervals for the worst value-at-risk as well as a basic worst value-at-risk allocation principle are introduced. The paper concludes with selected lessons learned from this experience. Keywords: computational risk management; rearrangement algorithm; implementation; R; bootstrap; worst value-at-risk allocation 1. Introduction Computational risk management is a comparably new and exciting field of research at the intersection of statistics, computer science and data science. It is concerned with computational problems of quantitative risk management, such as algorithms, their implementation, computability, numerical robustness, parallel computing, pitfalls in simulations, run-time optimization, software development and maintenance. At the end of the (business) day, solutions in quantitative risk management are to be run on a computer of some sort and thus concern computational risk management. There are various factors that can play a role when developing and implementing a solution to a problem from computational risk management in practice, for example: (1) Theoretical hurdles. Some solutions cannot be treated analytically anymore. Suppose X= (X1 , . . . , Xd) is a d -dimensional random vector of risk factor changes, for example negative log-returns, with marginal distribution functions F1 , . . . , Fd and we are interested in computing the probability P(Xj∈(F← j(pj) , F← j(qj)] , for all j) of the j th risk factor change to take on values between its pj - and its qj -quantile for all j . Even if we knew the joint distribution function H of X , computing such a probability analytically involves evaluating H at 2 d different values. For d≈ 32, this can already be time-consuming (not to speak of numerical inaccuracies appearing, which render the formula as good as useless) and for d≈ 260 the number of points at which to evaluate His roughly equal to the estimated number of atoms in the universe. (2) Model risk. The risk of using the wrong model or a model in which assumptions are not fulfilled; every solution we implement is affected by model risk to some degree. In the aforementioned example, not knowing the exact H leads to model risk when computing the given probability by Monte Carlo integration. (3) The choice of software. The risk of using the wrong software; in the above example, a software not suitable for simulating from joint distribution functions H . Another example is to use a Risks 2020,8, 47; doi:10.3390/risks8020047 www.mdpi.com/journal/risks Risks 2020,8, 47 2 of 28 programming language too low-level for the problem at hand, requiring to implement standard tasks (sampling, optimization, etc.) manually and thus bearing the risk of obtaining unreliable results because of many possible pitfalls one might encounter when developing the tools needed to implement the full-blown solution. These aspects become more crucial nowadays since efficient solutions to different problems are often only available in one software each but companies need to combine these solutions and thus the corresponding software in order to solve these different problems at hand. (4) Syntax errors. These are compilation errors or execution errors by an interpreter because of a violation of the syntax of the programming language under consideration. Syntax errors are typically easy to detect as the program simply stops to run. Also, many programming languages provide tools for debugging to find the culprits. (5) Run-time errors. These are errors that appear while a program runs. Quite often, run-time errors are numerical errors, errors that appear, for example, because of the floating-point representation of numbers in double precision. Run-time errors can sometimes be challenging to find, for example, when they only happen occasionally in a large-scale simulation study and introduce a non-suspicious bias in the results. Run-time errors can sometimes also be hard to reproduce. (6) Semantic errors. These are errors where the code is syntactically correct and the program runs, but it does not compute what is intended (for example, due to a flipped logical statement). If results do not look suspicious or pass all tests conducted, sometimes measuring run time can be the only way to find such problems (for example, if a program finishes much earlier than expected). (7) Scaling errors. These are errors of an otherwise perfectly fine running code that fails when run at large scale. This could be due to a lack of numerical robustness, the sheer run time of the code, an exploding number of parameters involved, etc. (8) User errors. These are errors caused by users of the software solution; for example, when calling functions with wrong arguments because of a misinterpretation of their meaning. The associated risk of wrongly using software can, by definition, often be viewed as part of operational risk. (9) Warnings. Warnings are important signs of what to watch out for; for example, a warning could indicate that a numerical optimization routine has not converged after a predetermined number of steps and only the current best value is returned, which might be far off a local or the global optimum. Unfortunately, especially in large-scale simulation studies, users often suppress warnings instead of collecting and considering them. (10) Run time. The risk of using or propagating method A over B because the run time of A beats the one of B by a split second or second, not realizing that run time depends on factors such as the hardware used, the current workload, the algorithm implemented, the programming language used, the implementation style, compiler flags, whether garbage collection was used, etc. There is not even a unique concept of time (system vs. user vs. elapsed time). (11) Development and maintenance. It is significantly more challenging to provide a robust, well developed, maintained and documented class of solutions as part of a bigger, coherent software package rather than a single script with hard-coded values to solve a special case of the same problem. Although stand-alone scripts get specific tasks done by 4 p.m., having a software package available is typically beneficial mid- to long-term. It can significantly reduce the risk of the aforementioned errors by reusing code well tested and applied by the users of the package or it can avoid the temptation of introducing errors long after the code was developed just because it suddenly looks suspicious although it is actually correct. At the core of all solutions to problems from computational risk management lies an algorithm, a well-defined (unambiguous) finite set of instructions (steps) for solving a problem. An implementation of an algorithm in a programming language allows one to see how a problem is actually solved, unlike a formulation in pseudo-code, which is often vague and thus opens the door Risks 2020,8, 47 3 of 28 for misinterpretation. A classical example is if pseudo-code says “Minimize the function. ..” without mentioning how initial values or intervals can be obtained. Another example is “Choose a tolerance ε> 0...” but one is left in the dark concerning what suitable tolerances ε are for the problem at hand; they often depend on the unknown output one is interested to compute in the first place, see Step (1) of Algorithm 1later. Oftentimes, these are the hardest parts to solve of the whole problem and it is important for research and scientific journals to accept corresponding contributions as important instead of brushing them off as “not innovative” or representing “no new contribution”. A fundamental principle when developing an implementation is that of a minimal working example. A minimal working example is source code that is a working example in the sense that it allows someone else to reproduce a problem (sufficiency) and it is minimal in the sense that it is as small and as simple as possible, without non-relevant code, data or dependencies (necessity). Minimal working examples are often constructed from existing larger chunks of code by divide and conquer, that is by breaking down the problem into sub-problems and commenting out non-relevant parts until the code becomes simple enough to show the problem (which is then easier to grasp and solve or can be sent to an expert in the field to ask for help). In this paper, we consider the problem of implementing the rearrangement algorithm (RA) of Embrechts et al. (2013) as an example from computational risk management. The RA allows one to compute, for example, the worst value-at-risk of the sum of d risks of which the marginal distributions are known but the dependence is unknown; it can also be used to compute the best value-at-risk or expected shortfall, but we focus on the worst value-at-risk. Section 2contains the necessary details about the RA. Section 3addresses how the major workhorse underlying this algorithm can be implemented in a straightforward way in R. This turns out to be inefficient and Section 4presents ways to improve the implementation. Section 5utilizes the implementations in our Rpackage qrmtools for tracing and to motivate the chosen default tolerances, and Section 6considers a real data example, presents a bootstrap confidence interval for worst value-at-risk and introduces a basic capital allocation principle based on worst value-at-risk. The lessons learned throughout the paper are summarized in Section 7. 2. The Rearrangement Algorithm in a Nutshell Let L1∼F1 , . . . , Ld∼Fd be continuously distributed loss random variables over a predetermined period and let L+=∑d j=1Lj be the total loss over that time period. From a risk management perspective we are interested in computing value-at-risk ( VaRα(L+) , VaRα or VaR )at confidence level α∈( 0, 1 ) , that is the α -quantile F← L+(α) = inf{x∈R:FL+(x)≥α} of the distribution function FL+ of L+ ; in typical applications, α∈[ 0.99, 1 ) . If we had enough joint observations, so realizations of the random vector L= (L1 , . . . , Ld) , we could estimate VaRα(L+) empirically. A major problem is that one often only has realizations of each of Lj individually, non-synchronized. This typically allows to pin down F1 , . . . , Fd but not the joint distribution function H of L . By Sklar’s Theorem, such H can be written as H(x) = C(F1(x1), . . . , Fd(xd)),x= (x1, . . . , xd)∈Rd, for a unique copula C . In other words, although we often know or can estimate F1 , . . . , Fd , we typically neither know the copula C nor have enough joint realizations to be able to estimate it. However, the copula C determines the dependence between L1 , . . . , Ld and thus the distribution of L+ as the following example shows. Example 1 (Motivation for rearrangements). Consider d= 2and Lj∼Fj(x) = 1 −x−1/2 , x≥ 1, j= 1, 2, that is both losses are Pareto Type I distributed with parameter 1 / 2. The left-hand side of Figure 1shows n= 1000 realizations of L= (L1 , L2) = (F← 1(U1) , F← 2(U2)) , once under independence, so for (U1 , U2)∼U( 0, 1 )2 , and once under comonotonicity, so for U1=U2∼U( 0, 1 ) . We see that the different dependence structures directly influence the shape of the realizations of L. Risks 2020,8, 47 4 of 28 1> qF <- function(y) (1-y)^(-2) # quantile function (the same for both margins here) 2> n <- 1000 # sample size 3> set.seed(271) # for reproducibility 4> L1 <- qF(runif(n)) # losses 1 5> L2 <- qF(runif(n)) # losses 2 6> L.indep <- cbind(L1, L2) 7> L.comon <- cbind(L1, sort(L2)[rank(L1)]) # sort L2 comonotone to L1 8> plot(L.indep, log = "xy", xlab = expression(L[1]), ylab = expression(L[2])) 9> points(L.comon, pch = 4) 10 > legend("top", bty = "n", pch = c(1, 4), 11 + legend = c("Independence", "Comonotonicity")) 12 > mtext(substitute(n==n.~"samples of two Pareto Type 1 losses with parameter 0.5", 13 + list(n. = n)), side = 4, line = 0.5, adj = 0) As the middle of Figure 1shows, the dependence also affects VaRα(L+) . This example is chosen to be rather extreme, (perhaps) in (stark) contrast to intuition, VaRα(L+) under independence is even larger than under comonotonicity, for all α ; this can also be shown analytically in this case in a rather tedious calculation; see (Hofert et al. 2020, Exercise 2.28). 1> alpha <- seq(0.5, 0.9999, length.out = 301) 2> VaR.L.indep.Par <- 2 * (1+sqrt(1-(1-alpha)^2)) / (1-alpha)^2 3> VaR.L.comon.Par <- 2 * qF(alpha) 4> plot(alpha, VaR.L.indep.Par, type = "l", log = "y", lty = 2, xlim = range(alpha), 5+ ylim = range(VaR.L.indep.Par, VaR.L.comon.Par), 6+ xlab = expression(alpha), ylab = expression(VaR[alpha](L^{'+'}))) 7> lines(alpha, VaR.L.comon.Par) 8> legend("topleft", bty = "n", lty = c(2, 1), 9+ legend = c("Independence", "Comonotonicity")) 10 > mtext("Two Pareto Type 1 losses with parameter 0.5", side = 4, line = 0.5, adj = 0) The right-hand side of Figure 1shows the same plot with the marginal distributions now being gamma. In this case, comonotonicity leads to larger values of VaRα(L+) than independence, but only for sufficiently large α ; the corresponding turning point seems to get larger the smaller the shape parameter of the second margin, for example. 1> shape <- c(1, 1/2) 2> VaR.L.indep.Ga <- qgamma(alpha, shape = sum(shape)) 3> VaR.L.comon.Ga <- qgamma(alpha, shape = shape[1]) + qgamma(alpha, shape = shape[2]) 4> plot(alpha, VaR.L.indep.Ga, type = "l", log = "y", lty = 2, xlim = range(alpha), 5+ ylim = range(VaR.L.indep.Ga, VaR.L.comon.Ga), 6+ xlab = expression(alpha), ylab = expression(VaR[alpha](L^{'+'}))) 7> lines(alpha, VaR.L.comon.Ga) 8> legend("topleft", bty = "n", lty = c(2, 1), 9+ legend = c("Independence", "Comonotonicity")) 10 > mtext(substitute("Two Gamma losses with shapes"~list(s1, s2), 11 + list(s1 = shape[1], s2 = shape[2])), side = 4, line = 0.5, adj = 0) Risks 2020,8, 47 5 of 28 1 100 10000 1e+00 1e+02 1e+04 1e+06 L1 L2 Independence Comonotonicity n=1000 samples of two Pareto Type 1 losses with parameter 0.5 0.5 0.6 0.7 0.8 0.9 1.0 1e+01 1e+03 1e+05 1e+07 α VaRα(L+) Independence Comonotonicity Two Pareto Type 1 losses with parameter 0.5 0.5 0.6 0.7 0.8 0.9 1.0 1 2 5 10 α VaRα(L+) Independence Comonotonicity Two Gamma losses with shapes 1, 0.5 Figure 1. One thousand realizations of independent L1 , L2 from a Pareto Type I distribution with parameter 1 / 2 ( left ), α7→ VaRα(L+) for these L1 , L2 ( middle ) and the same for two Gamma losses with parameters 1 and 1/2 (right). Note that we did not utilize the stochastic representation (L1 , L2) = (F← 1(U) , F← 2(U)) , U∼U( 0, 1 ) , for sampling L= (L1 , L2) . Instead, we sorted the realizations of L2 so that their ranks are aligned with those of L1 , in other words, so that the i th-smallest realization of L2 lies next to the i th-smallest realizations of L1 . The rows of this sample thus consist of (L(i)1 , L(i)2) , where L(i)j denotes the i th order statistic of the n realizations L1j , . . . , Lnj of Lj . Such a rearrangement mimics comonotonicity between the realizations of L1 and L2 . Note that this did not change the realizations of L1 or L2 individually, so it did not change the marginal realizations, only the joint ones. As we learned from Example 1, by rearranging the marginal loss realizations, we can mimic different dependence structures between the losses and thus influence VaRα(L+) . In practice, the worst VaRα(L+) , denoted by VaRα(L+) , is of interest, that is the largest VaRα(L+) for given margins L1∼F1 , . . . , Ld∼Fd . The following remark motivates an objective when rearranging marginal loss realizations in order to increase VaRα(L+)and thus approximate VaRα(L+). Remark 1 (Objective of rearrangements). (1) By Example 1, the question which copula C maximizes VaRα(L+) is thus, at least approximately, the question of which reordering of realizations of each of L1 , . . . , Ld leads to VaRα(L+) . For any C , the probability of exceeding VaRα(L+) is (at most, but for simplicity let us assume exactly) 1 −α . How that probability mass is distributed beyond VaRα(L+) depends on C . If we find a C such that L+ has a rather small variance var(L+) , more probability mass will be concentrated around a single point which can help to pull VaRα(L+) further into the right tail and thus increase VaRα(L+) ; Figure 2provides a sketch in terms of a skewed t3 density. If that single point exists and if var(L+) = 0, then it must be expected shortfall ESα(L+) = 1 1−αR1 αVaRu(L+)du, which provides an upper bound to VaRα(L+). Risks 2020,8, 47 6 of 28 fL+(x) VaRα(L+)ESα(L+) 1−α Figure 2. Skewed t3 density of L+ with VaRα(L+) and the probability mass of (at most) 1 −α exceeding it. (2) It becomes apparent from Figure 2that the distribution of L+ below its α -quantile is irrelevant for the location of VaRα(L+) . It thus suffices to consider losses L1 , . . . , Ld beyond their marginal α -quantiles F← 1(α) , . . . , F← d(α) , so the conditional losses Lj|Lj>F← j(α) , j= 1, . . . , d , and their copula Cα , called worst VaR copula. Note that since α is typically rather close to 1, the distribution of Lj|Lj>F← j(α) (the tail of Lj ) is typically modeled by a continuous distribution; this can be justified theoretically by the Pickands–Balkema–de-Haan Theorem, see (McNeil et al. 2015, Section 5.2.1). (3) In general, if var(L+) = 0cannot be attained, the smallest point of the support of L+ given that Lj>F← j(α), j =1, . . . , d, is taken as an approximation to VaRα(L+). The RA aims to compute VaRα(L+) by rearranging realizations of Lj|Lj>F← j(α) , j= 1, . . . , d , such that their sum becomes more and more constant, in order to approximately obtain the smallest possible variance and thus the largest VaRα(L+) . There are still fundamental open mathematical questions concerning the convergence of this algorithm, but this intuition is sufficient for us to understand the RA and to study its implementation. To this end, we now address the remaining underlying concepts we need. For each margin j= 1, . . . , d , the RA uses two discretizations of F← j beyond the probability α as realizations of Lj|Lj>F← j(α) to be rearranged. In practice, one would typically utilize the available data from Lj to estimate its distribution function Fj and then use the implied quantile function F← j of the fitted Fj to obtain such discretizations; see Section 6. Alternatively, F← j could be specified by expert opinion. The RA uses two discretizations to obtain upper and lower bounds to VaRα(L+) , which, when sufficiently close, can be used to obtain an estimate of VaRα(L+) , for example, by taking the midpoint. The two discretizations are stored in the matrices Xα=F− jα+ (1−α)i−1 Nj=1,...,d i=1,...,Nand Xα=F− jα+ (1−α)i Nj=1,...,d i=1,...,N. (1) These matrices are the central objects the RA works with. For simplicity of the argument, we write Xα= (Xα ij) if the argument applies to Xα or Xα . The RA iterates over the columns of Xα and successively rearranges each column in a way such that the row sums (∑d j=1Xα j)i=1,...,N of the rearranged matrix have a smaller variance; compare with Remark 1. Risks 2020,8, 47 7 of 28 In each rearrangement step, the RA rearranges the j th column Xα j of Xα oppositely to the vector of row sums Xα −j=∑d k=1,k6=jXα k of all other columns, where Xα k= (Xα 1k , . . . , Xα Nk) . Two vectors a= (a1 , . . . , aN) and b= (b1 , . . . , bN) are called oppositely ordered if (ai1−ai2)(bi1−bi2)≤ 0 for all i1 , i2= 1, . . . , N . After oppositely ordering, the (second-, third-, etc.) smallest component of a lies next to the (second-, third-, etc.) largest of b , which helps decrease the variance of their componentwise sum. To illustrate this, consider the following example. Example 2 (Motivation for oppositely ordering columns). We start by writing an auxiliary function to compute a matrix Xα with the modification that for Xα , 1-quantiles F− j( 1 ) appearing in the last row are replaced by F− jα+ ( 1 −α)N−1/2 N=F− j 1 −1−α 2N to avoid possible infinities; we come back to this point later. It is useful to start writing functions at this point, as we can reuse them later and rely on them for computing partial results, inputs needed, etc. In R, the function stopifnot() can be used to check inputs of functions. If any of the provided conditions fails, this would produce an error. For more elaborate error messages, one can work with stop() . Input checks are extremely important when functions are exported in a package (so visible to a user of the package) or even made available to users by simply sharing Rscripts. Code is often run by users who are not experts in the underlying theory or mechanisms and good input checks can prevent them from wrongly using the shared software; see Section 1Point (8). Also, documenting the function (here: Roxygen-style documentation) is important, providing easy to understand information about what the function computes, meaning of input parameters, return value and who wrote the function. 1>##'@title Matrix Containing Marginal Quantile Functions Evaluated Beyond 2>##'the Confidence Level 3>##'@param N integer > 0 giving the number of discretization points used 4>##'@param alpha confidence level in (0,1) 5>##'@param qF list of marginal quantile functions 6>##'@param upper logical indicating whether the matrix for the upper (the default) 7>##'or the lower discretization matrix is computed 8>##'@return (N, length(qF))-matrix containing in the jth column the jth marginal 9>##'quantile function evaluated on an equidistant grid in [alpha, 1]; 10 >##'if upper is TRUE, the last point is treated separately to avoid 11 >##'1-quantiles which may be Inf. 12 >##'@author Marius Hofert 13 > quantile_matrix <- function(N, alpha, qF, upper = TRUE) 14 + { 15 + stopifnot(N > 0, N %% 1 == 0, 0 < alpha, alpha < 1, is.list(qF), 16 + sapply(qF, is.function), is.logical(upper)) 17 + p <- alpha + (1-alpha) * (1:(N-1)) / N # grid of probabilities in (alpha, 1) 18 + p <- if(upper) { # for upper bound 19 + c(p, (p[length(p)] + 1) / 2) # attach last point (midpoint) 20 + } else { # for lower bound 21 + c(alpha, p) # attach first point = alpha 22 + } 23 + sapply(qF, function(qF.) qF.(p)) # (N, d)-matrix X^alpha 24 + } Consider d= 2and Lj∼Fj(x) = 1 −( 1 +x)−θj , x≥ 0, j= 1, 2, that is each of the two losses is Pareto distributed; we choose θ1= 3 / 2and θ2= 2here. We start by building the list of marginal quantile functions and then compute the corresponding (here: upper) quantile matrix Xα(= Xα)for α=0.9 and N =10 000. 1> library(qrmtools) 2> qF <- lapply(c(1.5, 2), function(th) function(p) qPar(p, shape = th)) 3> X <- quantile_matrix(1e4, alpha = 0.9, qF = qF) Risks 2020,8, 47 8 of 28 The columns in Xα are sorted in increasing order, so mimic comonotonicity in the joint tail, which leads to the following variance estimate of the row sums. 1> var(rowSums(X)) [1] 3519.706 If we randomly shuffle the first column, so mimicking independence in the joint tail, we obtain the following variance estimate. 1> X. <- X 2> set.seed(271) # for reproducibility 3> X.[,1] <- sample(X.[,1]) # randomly shuffling the first column 4> var(rowSums(X.)) # estimate the variance of the row sums [1] 2664.61 Now if we oppositely order the first column with respect to the sum of all others, here the second column, we can see that the variance of the resulting row sums will decrease; note that we mimic countermonotonicity in the joint tail in this case. 1> X. <- X 2> set.seed(271) # for reproducibility 3> X.[,1] <- sort(X.[,1], decreasing = TRUE)[rank(X.[,2])] # opposite reordering 4> var(rowSums(X.)) # estimate the variance of the row sums [1] 2614.33 The two marginal distributions largely differ in their heavy-tailedness, which is why the variance of their sum, even when oppositely reordered is still rather large. For θ1=θ2= 2, one obtains 138.6592, for two standard normal margins 0.0808 and for two standard uniform distributions 0. As a last underlying concept, the RA utilizes the minimal row sum operator s(X) = min 1≤i≤N∑ 1≤j≤d Xij for X∈RN×d, which is motivated in Remark 1Part (3). We are now ready to provide the RA. The RA as introduced in Embrechts et al. (2013) states that sN≤sN and in practice sN≈sN≈ VaRα(L+) . Furthermore, the initial randomizations in Steps (2.2) and (3.2) are introduced to avoid convergence problems of sN−sN→0. 3. A First Implementation of the Basic Rearrangement Step When implementing an algorithm such as the RA, it is typically a good idea to divide and conquer, which means breaking down the problem into sub-problems and addressing those first. Having implemented solutions to the sub-problems (write functions!), one can then use them as black boxes to implement the whole algorithm. In our case, we can already rely on the function quantile_matrix() for Steps (2.1) and (3.1) of the RA and we have already seen how to oppositely order two columns in Example 2. We also see that apart from which matrix is rearranged, Steps (2) and (3) are equal. We thus focus on this step in what follows. Example 3 (Basic rearrangements). We start with a basic implementation for computing one of the bounds sN,sNof the RA. Risks 2020,8, 47 15 of 28 1> res.ave <- apply(res, 1:2, mean) # average elapsed times 2> rank.worse <- round(100 * (res.ave["rank",] - res.ave["order",]) / res.ave["order",]) 3> tab <- as.data.frame.table(res, responseName = "Elapsed") # all results as a table 4> center <- seq_along(n) # x ticks centers 5> offset <- c(-0.2, 0.2) # deviations from the center 6> x.ticks <- as.vector(outer(offset, center, function(e, c) e+c)) # where to put x axis ticks 7> x.tick.labs <- rep(c("rank()", "order()"), length(n)) # x-axis labels 8> boxplot(Elapsed ~ Method + n, data = tab, log = "y", 9+ xlab = "", ylab = "Elapsed time in seconds", 10 + at = x.ticks, names = x.tick.labs, boxwex = rep(0.35, 2 * length(n))) 11 > x.labs <- as.expression(lapply(seq_along(n), function(k) # labels for secondary first axis 12 + substitute(atop(italic(n)==10^i., "rank() worse by "*p*"%"), 13 + list(i. = i[k], p = rank.worse[k])))) 14 > axis(1, at = center, tick = FALSE, line = 3, labels = x.labs) # secondary first axis rank() order() rank() order() rank() order() 0.005 0.010 0.020 0.050 0.100 0.200 0.500 1.000 Elapsed time in seconds n=105 rank() worse by 28% n=106 rank() worse by 25% n=107 rank() worse by 35% Figure 4. Box plot showing elapsed times in seconds when calling rank(, ties.method = "first") and order(order()) on samples of random numbers of size n . The labels indicate percentages of how much worse the former is in comparison to the latter. As a second improvement, recall that the RA naturally works on the columns of matrices. Matrices or arrays are internally stored as long vectors with attributes indicating when to “wrap around”. Accessing a matrix column thus requires to determine the beginning and the end of that column in the flattened vector. We can thus speed-up improved_rearrange() by working with lists of columns instead of matrices. The following example incorporates these two further improvements and some more. Example 6 (Advanced rearrangements). The following implementation saves column-access time by working with lists rather than matrices. We also use the slightly faster .rowSums() (as we know the dimensions of the input matrix) instead of rowSums() for computing the initial row sums once in the beginning, and we incorporate the idea of a nested order() call Risks 2020,8, 47 16 of 28 instead of rank() . Furthermore, before shuffling the columns, we also store their original sorted versions, which allows us to omit the call of sort() in improved_rearrange(). 1> advanced_rearrange <- function(X, tol) 2+ { 3+## Setup 4+ X.lst <- split(X, col(X)) # split 'matrix'X in columns 5+ X.lst.sorted <- X.lst # X is assumed to be sorted 6+ X.lst <- lapply(X.lst, sample) # randomly permute each 'column'(element of X.lst) 7+ N <- nrow(X) 8+ d <- ncol(X) 9+ X.rs <- .rowSums(do.call(cbind, X.lst), N, d) # compute initial row sums 10 + m.rs.old <- min(X.rs) # initial minimal row sums (to compare against) 11 + 12 +## Main 13 + while (TRUE) { 14 +## Update 15 + Y.lst <- X.lst # define list representing the 'matrix'Y (former 'matrix'X) 16 + Y.rs <- X.rs # row sums of Y (= row sums of X) 17 + 18 +## Loop over all columns and oppositely reorder the jth with respect to 19 +## the sum of all others 20 + for(j in 1:d) { 21 + Y.j <- Y.lst[[j]] # jth column 22 + Y.rs.mj <- Y.rs - Y.j # row sums without jth = total row sums - jth column 23 +## Oppositely order the jth column with respect to the sum of all others 24 + Y.j. <- X.lst.sorted[[j]][order(order(Y.rs.mj, decreasing = TRUE))] 25 +## Update the working 'matrix'and vector of row sums 26 + Y.lst[[j]] <- Y.j. # update with rearranged jth column 27 + Y.rs <- Y.rs.mj + Y.j. # update total row sum 28 + } 29 + m.rs.new <- min(Y.rs) # update minimal row sum 30 + 31 +## Check stopping criterion 32 + tol. <- abs((m.rs.new - m.rs.old) / m.rs.old) # relative change of minimal row sum 33 + tol.reached <- if(is.null(tol)) { # if NULL 34 + identical(Y.lst, X.lst) # stop only if no change after d iterations 35 + } else { tol. <= tol } # reached tolerance if tol. <= tol 36 + 37 +## If fulfilled, stop, otherwise update and continue 38 + if(tol.reached) { # if tolerance was reached 39 + break # break while() 40 + } else { # update (and continue) 41 + X.rs <- Y.rs # update the row sums 42 + m.rs.old <- m.rs.new # update minimal row sum 43 + X.lst <- Y.lst # update 'matrix'X 44 + } 45 + } 46 + 47 +## Return 48 + list(worst.VaR = min(Y.rs), X.rearranged = do.call(cbind, Y.lst)) 49 + } We now check for correctness of advanced_rearrange() and measure its run time in our running example. Concerning correctness, for the more involved advanced_rearrange() it is especially useful to have Risks 2020,8, 47 17 of 28 simpler versions available to check against; we use the result of improved_rearrange() here as we already checked it, but could have equally well used the one of basic_rearrange(). 1> set.seed(271) # for reproducibility 2> time.adv <- system.time(res.adv <- advanced_rearrange(X, tol = eps))[["elapsed"]] 3> stopifnot(all.equal(res.adv[["X.rearranged"]], res.imp[["X.rearranged"]], # comparison 4+ check.attributes = FALSE)) 5> time.adv # elapsed time in seconds [1] 0.632 Although the gain in run time is not as dramatic as before, we still see an improvement of about 62% in comparison to improved_rearrange(). 4.4. Comparison with the Actual Implementation The computational improvements so far have already lead to a percentage improvement of 94% in comparison to basic_rearrange() in our running example. The following example compares our fastest function advanced_rearrange() so far with our implementation rearrange() in the Rpackage qrmtools whose development was motivated by a risk management team at a Swiss bank. Example 7 (Comparison with rearrange()). To save even more run time, the function rearrange() from the Rpackage qrmtools splits the input matrix into its columns at C level. It also uses an early stopping criterion in the sense that after all columns have been rearranged once, stopping is checked after every column rearrangement. Because of the latter, the result is not quite comparable to our previous versions. 1> library(qrmtools) 2> set.seed(271) # for reproducibility 3> res.rearr <- rearrange(X, tol = eps) 4> all.equal(res.rearr[["X.rearranged"]], res.adv[["X.rearranged"]], # comparison 5+ check.attributes = FALSE) [1] "Mean relative difference: 5.611011e-05" We did not measure run time here since, similar to Heisenberg’s uncertainty principle, the difference in run time becomes more and more random; this is in line with the point we made about run-time measurement in the introduction. In other words, the two implementations become closer in run time. This can be demonstrated by repeated measurements. 1> B <- 20 # number of replications 2> res <- matrix(, nrow = B, ncol = 2, 3+ dimnames = list(Replication = 1:B, Method = c("advanced", "rearrange"))) 4> set.seed(271) # for reproducibility 5> res[,"advanced"] <- 6+ replicate(B, expr = system.time(advanced_rearrange(X, tol = eps))[["elapsed"]]) 7> set.seed(271) # for reproducibility 8> res[,"rearrange"] <- 9+ replicate(B, expr = system.time(rearrange(X, tol = eps))[["elapsed"]]) 10 > tab <- as.data.frame.table(res, responseName = "Elapsed") # all results as a table 11 > boxplot(Elapsed ~ Method, data = tab, xlab = "", ylab = "Elapsed time in seconds", 12 + names = c("advanced_rearrange()", "rearrange()"), boxwex = rep(0.35, 2)) As we see from the box plot in Figure 5, on average, rearrange() is slightly faster than advanced_rearrange() . Although rearrange() could even be made faster, it also computes and returns Risks 2020,8, 47 18 of 28 more information about the rearrangements than advanced_rearrange() ; for example, the computed minimal row sums after each column rearrangement and the row of the final rearranged matrix corresponding to the minimal row sum in our case here. Given that this is a function applied by users who are not necessarily familiar with the rearrangement algorithm, it is more important to provide such information. Nevertheless, rearrange() is still faster than advanced_rearrange() on average. advanced_rearrange() rearrange() 0.50 0.55 0.60 Elapsed time in seconds Figure 5. Box plot showing elapsed times in seconds when calling advanced_rearrange() and rearrange() of the Rpackage qrmtools in our running example. The function rearrange() is the workhorse underlying the function RA() that implements the rearrangement algorithm in the Rpackage qrmtools . The adaptive rearrangement algorithm (ARA) introduced in Hofert et al. (2017) improves the RA in that it introduces the joint tolerance, that is the tolerance between sN and sN ; the tolerance used so far is called individual tolerance. The ARA applies column rearrangements until the individual tolerance is met for each of the two bounds and until the joint tolerance is met or a maximal number of column rearrangements has been reached. If the latter is the case, N is increased and the procedure repeated. The ARA implementation ARA() in qrmtools also returns useful information about how the algorithm proceeded. Overall, ARA() neither requires to choose a tolerance nor the number of discretization points, which makes this algorithm straightforward to apply in practice where the choice of such tuning parameters is often unclear. Finding good tuning parameters (adaptively or not) is often a significant problem in newly suggested procedures and not rarely a question open for future research by itself. 5. The Functions rearrange() and ARA() In this section we utilize the implementations rearrange() and ARA() of the rearrangement step and the adaptive rearrangement algorithm. Example 8 (Tracing rearrange()). The implementation rearrange() has a tracing feature. It can produce a lot of output but we here consider the rather minimal example of rearranging the matrix X=   111 222 333   . Risks 2020,8, 47 19 of 28 The following code enables tracing ( trace = TRUE ) to see how the column rearrangements proceed; to this end we rearrange until all columns are oppositely ordered to the sum of all other columns ( tol = NULL ), disable random permutation of the columns ( sample = FALSE ) and provide the information that the columns are already sorted here (is.sorted = TRUE). 1> trace <- rearrange(matrix(rep(1:3, times = 3), ncol = 3), tol = NULL, 2+ sample = FALSE, is.sorted = TRUE, trace = TRUE) [1,] 1 1 1 [2,] 2 2 2 [3,] 3 3 3 | -col sum [1,] 3 1 1 2 5 [2,] 2 2 2 4 6 [3,] 1 3 3 6 7 = -col sum [1,] 3 1 1 4 5 [2,] 2 2 2 4 6 [3,] 1 3 3 4 7 = -col sum [1,] 3 1 1 4 5 [2,] 2 2 2 4 6 [3,] 1 3 3 4 7 = -col sum [1,] 3 1 1 2 5 [2,] 2 2 2 4 6 [3,] 1 3 3 6 7 A “ | ” or “ = ” symbol over the just worked on column indicates whether this column was changed (“ | ”) or not (“ = ”) in this rearrangement step. The last two printed columns provide the row sums of all other columns as well as the new updated total row sums after the rearrangement. As we can see from this example, the rearranged matrix has minimal row sum 5and is given by    311 222 133   ,whereas the matrix    123 231 312    would have led to the larger minimal row sum 6; this rather constructed example for when the greedy column rearrangements of the RA can fail to provide the maximal minimal row sum was provided by Haus (2015). As more interesting example to trace is to rearrange the matrix      111 232 354 478      ; see the vignette VaR_bounds of the Rpackage qrmtools. Example 9 (Calling ARA()). We now call ARA() in the case of our running example in this paper. Risks 2020,8, 47 20 of 28 1> ARA. <- ARA(alpha, qF = qF) 2> str(ARA.) List of 10 $ bounds : Named num [1:2] 7596 7638 ..- attr(*, "names")= chr [1:2] "low" "up" $ rel.ra.gap : num 0.00558 $ tol : Named num [1:3] 0 0 0.00558 ..- attr(*, "names")= chr [1:3] "low" "up" "joint" $ converged : Named logi [1:3] TRUE TRUE TRUE ..- attr(*, "names")= chr [1:3] "low" "up" "joint" $ N.used : num 8192 $ num.ra : Named int [1:2] 767 879 ..- attr(*, "names")= chr [1:2] "low" "up" $ opt.row.sums :List of 2 ..$ low: num [1:767] 5547 5924 6193 6396 6562 ... ..$ up : num [1:879] 5553 5939 6205 6408 6570 ... $ X :List of 2 ..$ low: num [1:8192, 1:128] 92.2 92.2 92.2 92.2 92.2 ... ..$ up : num [1:8192, 1:128] 92.2 92.2 92.2 92.2 92.2 ... $ X.rearranged :List of 2 ..$ low: num [1:8192, 1:128] 797 457 138 202 170 ... ..$ up : num [1:8192, 1:128] 135 107 191 113 963 ... $ X.rearranged.opt.row:List of 2 ..$ low: num [1:128] 107.2 99.5 92.6 86.5 80.9 ... ..$ up : num [1:128] 129 116 106 98 823 ... As we can see, the implementation returns a list with the computed bounds sN , sN , the relative rearrangement gap (sN−sN)/sN , the two individual and one joint tolerance reached on stopping, a corresponding vector of logicals indicating whether the required tolerances have been met, the number N of discretization points used in the final step, the number of considered column rearrangements for each bound, vectors of computed optimal (for worst VaR this means “minimal”) row sums after each column rearrangement considered, a list with the two input matrices Xα , Xα , a list with the corresponding final rearranged matrices Yα , Yα and the rows corresponding to their optimal row sums. An estimate of VaR0.99(L+) in our running example can then be computed as follows. 1> worst.VaR <- mean(ARA.[["bounds"]]) # estimate of worst VaR 2> stopifnot(all.equal(worst.VaR, res.adv[["worst.VaR"]], tol = 5e-3)) # comparison 3> worst.VaR [1] 7617.149 Figure 6shows the minimal row sum as a function of the number of rearranged columns for each of the two bounds sN and sN on VaR0.99 in our running example. We can see that already after all columns were rearranged once, the actual value of the two bounds does not change much anymore in this case, yet the algorithm still proceeds until the required tolerances are met. Risks 2020,8, 47 21 of 28 1> opt <- ARA.[["opt.row.sums"]] # 2-list with minimal row sums for each bound 2> ylim <- range(opt) # range of all minimal row sums 3> len <- sapply(opt, length) # length of the components of the 2-list 4> ii <- which.min(len) # index of the shorter one 5> n <- max(len) # length of the longer one 6> opt[[ii]] <- c(opt[[ii]], rep(NA, n - length(opt[[ii]]))) # fill with NA 7> min.row.sums <- matrix(unlist(opt), ncol = 2, dimnames = list(NULL, c("low", "up"))) 8> iter <- seq_len(n) # sequence from 1 to the maximal length 9> plot(iter, min.row.sums[,"up"], type = "l", log = "x", # upper bound 10 + xlab = "Number of column rearrangements", ylab = "Minimal row sum") 11 > lines(iter, min.row.sums[,"low"], type = "l", lty = 2) # lower bound 12 > mtext(substitute("Individual and joint tolerances = ("*tol.*"), N used ="~N., 13 + list(tol. = paste(round(ARA.[["tol"]], 4), collapse = ", "), 14 + N. = ARA.[["N.used"]])), 15 + side = 4, line = 0.5, adj = 0) 16 > legend("bottomright", bty = "n", lty = 1:2, 17 + legend = c(expression("Upper bound"~bar(s)[N]), 18 + expression("Lower bound"~underline(s)[N]))) 1 5 10 50 100 500 1000 5500 6000 6500 7000 7500 Number of column rearrangements Minimal row sum Individual and joint tolerances = (0, 0, 0.0056), N used = 8192 Upper bound sN Lower bound sN Figure 6. Minimal row sums after each column rearrangement for the lower and upper bounds sN and sNon VaR0.99 in our running example. 6. Applications We now consider a real data example and introduce bootstrap confidence intervals for VaR0.99 as well as a basic worst VaR allocation principle. Example 10 (A real-life example). We consider negative log-returns of Google, Apple and Microsoft stocks from 2006-01-03 to 2010-12-31. Risks 2020,8, 47 22 of 28 1> library(qrmdata) 2> data("SP500_const") # load the constituents of the S&P 500 3> stocks <- c("GOOGL", "AAPL", "MSFT") # stocks we consider (Google, Apple, Microsoft) 4> d <- length(stocks) # dimension 5> time <- c("2006-01-03", "2010-12-31") # time period considered 6> S <- SP500_const[paste0(time, collapse = "/"), stocks] # pick out data 7> stopifnot(all(!is.na(S))) # check that there is no missing data 8> X <- -returns(S) # -log-returns We treat the negative log-returns as (roughly) stationary here and consider mean excess plots in Figure 7to determine suitable thresholds for applying the peaks-over-threshold method. 1> mean_excess_plot(X[X[,"GOOGL"] > 0, "GOOGL"]) 2> abline(v = 0.012) # threshold choice 3> mean_excess_plot(X[X[,"AAPL"] > 0, "AAPL"]) 4> abline(v = 0.021) # threshold choice 5> mean_excess_plot(X[X[,"MSFT"] > 0, "MSFT"]) 6> abline(v = 0.017) # threshold choice 7> u <- c(0.012, 0.021, 0.017) 0.00 0.02 0.04 0.06 0.08 0.015 0.016 0.017 0.018 0.019 0.020 0.021 Threshold Mean excess over threshold 0.00 0.02 0.04 0.06 0.08 0.020 0.025 0.030 0.035 0.040 0.045 Threshold Mean excess over threshold 0.00 0.02 0.04 0.06 0.08 0.014 0.016 0.018 0.020 0.022 0.024 0.026 0.028 Threshold Mean excess over threshold Figure 7. Mean excess plots for the negative log-returns of GOOGL ( left ), AAPL ( middle ) and MSFT (right) with chosen thresholds indicated by vertical lines. We then fit generalized Pareto distributions (GPDs) to the excess losses over these thresholds. 1> fit <- lapply(1:d, function(j) fit_GPD_MLE(X[X[,j] > u[j],j] - u[j])) 2> params <- sapply(fit, function(x) x$par) 3> colnames(params) <- names(X) We consider the corresponding quantile functions as approximate quantile functions to our empirical losses; see (McNeil et al. 2015, Section 5.2.3). 1> p.exceed <- sapply(1:d, function(j) mean(X[,j] > u[j])) #probability of exceeding threshold 2> stopifnot(alpha >= max(1 - p.exceed)) # check validity condition of tail approximation 3> qF <- lapply(1:d, function(j) function(p) # list of quantile functions 4+ qGPDtail(p, threshold = u[j], p.exceed = p.exceed[j], 5+ shape = params["shape",j], scale = params["scale",j])) Based on these quantile functions, we can then compute VaR0.99(L+)with ARA(). Risks 2020,8, 47 23 of 28 1> alpha <- 0.99 # confidence level 2> ARA. <- ARA(alpha, qF = qF) # compute worst VaR 3> mean(ARA.[["bounds"]]) # worst VaR estimate [1] 0.2541438 Given the additional information obtained from ARA() , we can also visualize a (pseudo-)sample from the worst VaR copula Cα , see Figure 8. Such a sample is obtained by computing the pseudo-observations, that is componentwise ranks scaled to ( 0, 1 ) , of the rearranged matrix Yα corresponding to the upper bound sN ; we could have also considered Yαhere. 1> library(copula) 2> U <- pobs(ARA.[["X.rearranged"]]\$up) # pseudo-observations of Y for the upper bound 3> colnames(U) <- paste0("U[", 1:3, "]") 4> pairs2(U) # worst VaR dependence as a pairs plot 5> cloud2(U, screen = list(z = -30, x = -60)) # worst VaR dependence as a 3d plot U1 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 U2 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 U3 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 U1 U2 U3 Figure 8. Pairs plot ( left ) and 3D scatter plot ( right ) of the pseudo-observations of the rearranged Yα , so a sample from the worst VaR copula Cα. Also, we can investigate how much the VaR0.99(L+) bounds sN and sN change with changing individual relative tolerance. Figure 9motivates the use of 0as individual relative tolerance; this is often quite a bit faster than NULL and provides similar VaR0.99(L+)bounds. 1> itol <- c(NA, seq(0, 0.5, length.out = 21)) #individual tolerances used; NA encodes 'NULL' 2> res <- t(sapply(itol, function(t) # worst VaR bounds for all individual tolerances 3+ ARA(alpha, qF = qF, reltol = c(if(is.na(t)) NULL else t, 0.01))[["bounds"]])) 4> colnames(res) <- c("low", "up") 5> plot(itol, res[,"up"], type = "b", log = "y", ylim = range(res), 6+ xlab = "Individual relative tolerance", 7+ ylab = substitute("Bounds on"~bar(VaR)[a](L^{"+"}), list(a = alpha))) 8> lines(itol, res[,"low"], type = "b", lty = 2) 9> points(c(0, 0), res[1,], pch = 3) # add 'NULL'case at 0 10 > legend("topright", bty = "n", lty = c(1:2, NA), pch = c(NA, NA, 3), 11 + legend = c(expression("Upper bound"~bar(s)[N]), 12 + expression("Lower bound"~underline(s)[N]), "case 'NULL'")) Risks 2020,8, 47 24 of 28 0.0 0.1 0.2 0.3 0.4 0.5 0.2520 0.2525 0.2530 0.2535 0.2540 0.2545 Individual relative tolerance Bounds on VaR0.99(L+) Upper bound sN Lower bound sN case 'NULL' Figure 9. Bounds sNand sNon VaR0.99(L+)as functions of the chosen individual relative tolerance. Example 11 (Bootstrap confidence interval for worst VaR). As in Example 10 and mentioned in Section 2, the marginal quantile functions used as input for the rearrangement algorithm may need to be estimated from data. The corresponding estimation error translates to a confidence interval for VaR0.99(L+) , which we can obtain from a bootstrap. To this end, we start by building B bootstrap samples from the negative log-returns; we choose a rather small B =20 here to demonstrate the idea. 1> B <- 20 # bootstrap sample size 2> set.seed(271) # for reproducibility 3> X.boot <- lapply(1:B, function(b) # B-list of (nrow(X), d)-matrices 4+ apply(X, 2, function(x.) sample(x., replace = TRUE))) Next, we build excess losses over 90% thresholds (a typical broad-brush choice in practice), fit GPDs to the d component samples for each of the B bootstrap samples and construct the corresponding quantile functions. 1> u.prob <- 0.9 # threshold as probability 2> stopifnot(alpha >= u.prob) # check validity condition 3> qF.boot <- lapply(X.boot, function(x) { # x is a d-list of resampled -log-returns 4+ lapply(1:d, function(j) { # going over all margins 5+ u <- quantile(x[,j], probs = u.prob, names = FALSE) # threshold 6+ excesses <- x[x[,j] > u, j] - u # excess losses 7+ params <- fit_GPD_MLE(excesses)\$par # fitted GPD (shape, scale) vector 8+ function(p) qGPDtail(p, threshold = u, p.exceed = 1 - u.prob, 9+ shape = params[["shape"]], scale = params[["scale"]]) 10 + }) 11 + }) # B-list of d-lists (one for each stock) of quantile functions Now we can call ARA() with each of the B sets of marginal quantile functions. 1> worst.VaR.boot <- lapply(qF.boot, function(qFs) ARA(alpha, qF = qFs)) #B-list of ARA() obj. And then extract the computed estimates of VaR0.99(L+). 1> worst.VaRs <- sapply(worst.VaR.boot, function(ara) mean(ara[["bounds"]])) 2> summary(worst.VaRs) # a summary Min. 1st Qu. Median Mean 3rd Qu. Max. 0.2215 0.2355 0.2417 0.2444 0.2522 0.2841