Learn R Programming

qrmtools (version 0.0-15)

alloc: Computing allocations

Description

Computing (capital) allocations.

Usage

## For elliptical distributions under certain assumptions
alloc_ellip(total, loc, scale)

## Nonparametrically conditioning(x, level, risk.measure = "VaR_np", ...) alloc_np(x, level, risk.measure = "VaR_np", include.conditional = FALSE, ...)

Value

\(d\)-vector of allocated amounts (the allocation) according to the Euler principle under the assumption that the underlying loss random vector follows a \(d\)-dimensional elliptical distribution with location vector loc (\(\bm{mu}\) in the reference) and scale matrix scale (\(\Sigma\) in the reference, a covariance matrix) and that the risk measure is law-invariant, positive-homogeneous and translation invariant.

Arguments

total

total to be allocated (typically the risk measure of the sum of the underlying loss random variables).

loc

location vector of the elliptical distribution of the loss random vector.

scale

scale (covariance) matrix of the elliptical distribution of the loss random vector.

x

\((n, d)\)-matrix containing \(n\) iid \(d\)-dimensional losses.

level

either one or two confidence level(s) for risk.measure; in the former case the upper bound on the conditioning region is determined by confidence level 1.

risk.measure

character string or function specifying the risk measure to be computed on the row sums of x based on the given level(s) in order to determine the conditioning region.

include.conditional

logical indicating whether the computed sub-sample of x is to be returned, too.

...

additional arguments passed to risk.measure.

Author

Marius Hofert

Details

The result of alloc_ellip() for loc = 0 can be found in McNeil et al. (2015, Corollary 8.43). Otherwise, McNeil et al. (2015, Theorem 8.28 (1)) can be used to derive the result.

References

McNeil, A. J., Frey, R. and Embrechts, P. (2015). Quantitative Risk Management: Concepts, Techniques, Tools. Princeton University Press.

Examples

Run this code
### Ellipitical case ###########################################################

## Construct a covariance matrix
sig <- 1:3 # standard deviations
library(copula) # for p2P() here
P <- p2P(c(-0.5, 0.3, 0.5)) # (3, 3) correlation matrix
Sigma <- P * sig %*% t(sig) # corresponding covariance matrix
stopifnot(all.equal(cov2cor(Sigma), P)) # sanity check

## Compute the allocation of 1.2 for a joint loss L ~ E_3(0, Sigma, psi)
AC <- alloc_ellip(1.2, loc = 0, scale = Sigma) # allocated amounts
stopifnot(all.equal(sum(AC), 1.2)) # sanity check
## Be careful to check whether the aforementioned assumptions hold.


### Nonparametrically ##########################################################

## Generate data
set.seed(271)
X <- qt(rCopula(1e5, copula = gumbelCopula(2, dim = 5)), df = 3.5)

## Estimate an allocation via MC based on a sub-sample whose row sums have a
## nonparametric VaR with confidence level in ...
alloc_np(X, level = 0.9) # ... (0.9, 1]
CA  <- alloc_np(X, level = c(0.9, 0.95)) # ... in (0.9, 0.95]
CA. <- alloc_np(X, level = c(0.9, 0.95), risk.measure = VaR_np) # providing a function
stopifnot(identical(CA, CA.))

Run the code above in your browser using DataLab