alloc | R Documentation |
Computing (capital) allocations.
## 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, ...)
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 |
|
include.conditional |
|
... |
additional arguments passed to |
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.
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
(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.
Marius Hofert
McNeil, A. J., Frey, R. and Embrechts, P. (2015). Quantitative Risk Management: Concepts, Techniques, Tools. Princeton University Press.
### 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.))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.