Package 'OCA'

Title: Optimal Capital Allocations
Description: Computes optimal capital allocations based on some standard principles such as Haircut, Overbeck type II and the Covariance Allocation Principle. It also provides some shortcuts for obtaining the Value at Risk and the Expectation Shortfall, using both the normal and the t-student distribution, see Urbina and Guillén (2014)<doi:10.1016/j.eswa.2014.05.017> and Urbina (2013)<http://hdl.handle.net/2099.1/19443>.
Authors: Jilber Urbina
Maintainer: Jilber Urbina <[email protected]>
License: GPL-2
Version: 0.5
Built: 2024-12-08 06:49:10 UTC
Source: CRAN

Help Index


Covariance Allocation Principle

Description

This function implements the covariance allocation principle for optimal capital allocation.

Usage

cap(Loss, Capital)

Arguments

Loss

A matrix containing the individual losses in each column

Capital

A scalar representing the capital to be allocated to each loss.

Details

The Covariance Allocation Principle correspond to the following expression:

\[K_{i} = \dfrac{K}{Var[S]} Cov(X_{i}, S), \quad i=1, \ldots, n,\]

where \(K_i\) is the capital to be allocated to the ith loss, \(K\) is the total capital to be allocated, \(X_i\) is the individual unit loss and S is the total (aggretate) loss, this comes from \(\sum_{i}X_{i}\). \(Cov(X_{i}, S)\) is the covariance between the individual loss \(X_i\) and the aggregate loss S; and \(Var(S)\) is the variance of the aggregate loss.

Value

A vector containing each asset and the corresponding capital allocation. If Capital=1, then the returned value will be the proportions of capital required by each loss to be faced.

Author(s)

Jilber Urbina

References

Dhaene J., Tsanakas A., Valdez E. and Vanduffel S. (2011). Optimal Capital Allocation Principles. The Journal of Risk and Insurance. Vol. 00, No. 0, 1-28.

Urbina, J. (2013) Quantifying Optimal Capital Allocation Principles based on Risk Measures. Master Thesis, Universitat Politècnica de Catalunya.

Urbina, J. and Guillén, M. (2014). An application of capital allocation principles to operational risk and the cost of fraud. Expert Systems with Applications. 41(16):7023-7031.

Examples

data(dat1, dat2)
Loss <- cbind(Loss1=dat1[1:400, ], Loss2=unname(dat2))
# Proportions of capital to be allocated to each bussines unit
cap(Loss, Capital=1)

# Capital allocation,
# capital is determined as the empirical VaR of the losses at 99\%
K <- quantile(rowSums(Loss),  probs = 0.99)
cap(Loss, Capital=K)

Public data risk no. 1

Description

Dataset named Public data risk no. 1 consisting in 1000 of simulated data.

Usage

data(dat1)

Format

A data frame with 1000 observations on the following variable.

y

a numeric vector

References

Bolance, C.; Guillen, M.; Gustafsson, J. & Nielsen, J. P. Quantitative Operational Risk Models Chapman & Hall/CRC, 2012

Examples

data(dat1)

Public data risk no. 2

Description

Dataset named Public data risk no. 1 consisting in 400 of simulated data.

Usage

data(dat2)

Format

A data frame with 400 observations on the following variable.

y

a numeric vector

References

Bolance, C.; Guillen, M.; Gustafsson, J. & Nielsen, J. P. Quantitative Operational Risk Models Chapman & Hall/CRC, 2012

Examples

data(dat2)

Expected Shortfall

Description

Computes the Expected Shortfall of a given amount of loss based on variance-covariance method.

Usage

ES(
  variance,
  alpha = 0.95,
  weights = NULL,
  model = c("normal", "t-student", "both"),
  df = NULL,
  percentage = FALSE
)

Arguments

variance

It could be either a scalar or a matrix containing the variances and covariances of the losses. Provide a covariance matrix when analyzing correlated losses or a scalar when dealing with a single loss.

alpha

A numeric value (either a single one or a vector) consisting of the significance level at which ES has to be computed, it can either be a single numeric value or a vector of numeric values.

weights

A vector of weights of size N for weighting the variance of losses. When weights=NULL variances used to compute ES are the original values supplied to variance with no weighting scheme.

model

A character string indicating which distribution is to be used for computing the ES, the default value is the normal distribution, the other alternative is t-student distribution with υ degrees of freedom. When model='both' 'normal' as well as 't-student' are used when computing the ES, see examples.

df

An integer indicating the degrees of freedom for the t-student distribution when setting model='t-student' and model='both'. df must be greater than 2.

percentage

Logical indicating whether the file names in the VaR table should be presented in percentage or decimal.

Details

ES computes the Expected Shortfall (ES) of a certaing amount of loss based upon the following general formulation:

\[ES_\alpha = \dfrac{1}{1-\alpha}\int_{\alpha}^{1} VaR_u(X)du = E[X|X > F_{X}^{-1}(\alpha)]\]

where \(\alpha\) is the significance level, \(VaR_u(X)\) is the Value-at-Risk of \(X.\)

ES for the normal case is based on the following expression:

\[ES_{\alpha} = \mu + \sigma \frac{\phi(\Phi^{-1}(\alpha))}{1-\alpha}\]

Meanwhile, ES for the t-student distribution takes comes from:

\[ES_{\alpha}(\tilde{X}) = \frac{g_{\upsilon}(t_{\upsilon}^{-1}(\alpha))}{1-\alpha} \left( \frac{\upsilon+(t_{\upsilon}^{-1}(\alpha))^{2}}{\upsilon - 1} \right)\]

Author(s)

Jilber Urbina

References

Dhaene J., Tsanakas A., Valdez E. and Vanduffel S. (2011). Optimal Capital Allocation Principles. The Journal of Risk and Insurance. Vol. 00, No. 0, 1-28.

McNeil, A. J.; Frey, R. & Embrechts, P. Quantitative risk management: concepts, techniques and tools. Princeton University Press, 2005.

Urbina, J. (2013) Quantifying Optimal Capital Allocation Principles based on Risk Measures. Master Thesis, Universitat Politècnica de Catalunya.

Urbina, J. and Guillén, M. (2014). An application of capital allocation principles to operational risk and the cost of fraud. Expert Systems with Applications. 41(16):7023-7031.

Examples

# Exercise 2.21, page 46 in McNeil et al (2005)
alpha <- c(.90, .95, .975, .99, .995)
(ES(variance=(0.2/sqrt(250))^2, alpha=alpha, model='normal'))*10000
(ES(variance=(0.2/sqrt(250))^2, alpha=alpha, model='t-student', df=4))*10000

# Both type of models at once.
(ES(variance=(0.2/sqrt(250))^2, alpha=alpha, model='both', df=4))*10000

# A vector of losses
variance <- matrix(c(100,150,150,900), 2) # covariance matrix
w <- c(0.5, 0.5)                        # a vector weights
ES(variance=variance, weights=w, alpha=0.95)

Haircut Allocation Principle

Description

Capital allocation based on the Haircut Allocation Principle.

Usage

hap(Loss, Capital, alpha = 0.95, model = "normal", df = NULL)

Arguments

Loss

Either a scalar or a vector of size N containing the mean losses.

Capital

A scalar representing the capital to be allocated to each loss.

alpha

A numeric value (either a single one or a vector) consisting of the significance level at which ES has to be computed, it can either be a single numeric value or a vector of numeric values.

model

A character string indicating which distribution is to be used for computing the VaR underlying the Haircut Allocation Principle (HAP), the default value is the normal distribution, the other alternative is t-student distribution with υ degrees of freedom. When model='both' 'normal' as well as 't-student' are used when computing the HAP, see examples.

df

An integer indicating the degrees of freedom for the t-student distribution when setting model='t-student' and model='both'. df must be greater than 2.

Details

This function computes the capital allocation based on the so-called Haircut Allocation Principle whose expression is as follows:

\[K_{i} = \frac{K}{\sum_{j=1}^{n} F_{X_{j}}^{-1}(p)} F_{X_{i}}^{-1}(p)\]

For \(i=1,\dots,n\), where \(K_i\) represents the optimal capital to be allocated to each individual loss for the i-th business unit, K is the total capital to be allocated, \(F_{X_{i}}^{-1}(p)\) is the quantile function (VaR) for the i-th loss.

Value

A vector containing the optimal capital allocation, if Capital is set to 1, then the returned matrix will consist of the proportions of capital each individual loss needs to be optimally faced.

Author(s)

Jilber Urbina

References

Dhaene J., Tsanakas A., Valdez E. and Vanduffel S. (2011). Optimal Capital Allocation Principles. The Journal of Risk and Insurance. Vol. 00, No. 0, 1-28.

McNeil, A. J.; Frey, R. & Embrechts, P. Quantitative risk management: concepts, techniques and tools. Princeton University Press, 2005.

Urbina, J. (2013) Quantifying Optimal Capital Allocation Principles based on Risk Measures. Master Thesis, Universitat Politècnica de Catalunya.

Urbina, J. and Guillén, M. (2014). An application of capital allocation principles to operational risk and the cost of fraud. Expert Systems with Applications. 41(16):7023-7031.

See Also

Overbeck2, cap

Examples

data(dat1, dat2)
Loss <- cbind(Loss1=dat1[1:400, ], Loss2=unname(dat2))
# Proportions of capital to be allocated to each bussines unit
hap(Loss, Capital=1)

# Capital allocation,
# capital is determined as the empirical VaR of the losses at 99\%
K <- quantile(rowSums(Loss),  probs = 0.99)
hap(Loss, Capital=K)

Overbeck type II Allocation Principle

Description

This function implements the Overbeck type II allocation principle for optimal capital allocation.

Usage

Overbeck2(
  Loss,
  Capital,
  alpha = 0.95,
  model = c("normal", "t-student", "both"),
  df = NULL
)

Arguments

Loss

Either a scalar or a vector of size N containing the mean losses.

Capital

A scalar representing the capital to be allocated to each loss.

alpha

A numeric value (either a single one or a vector) consisting of the significance level at which the allocation has to be computed, it can either be a single numeric value or a vector of numeric values.

model

A character string indicating which distribution is to be used for computing the VaR underlying the Overbeck type II principle, the default value is the normal distribution, the other alternative is t-student distribution with υ degrees of freedom. When model='both' 'normal' as well as 't-student' are used when computing the allocations, see examples.

df

An integer indicating the degrees of freedom for the t-student distribution when setting model='t-student' and model='both'. df must be greater than 2.

Details

Overbeck2 computes the capital allocation based on the following formulation:

\[K_{i} = \frac{K}{CTE_{p}[S]} E \left[ X_{i}|S > F_{X_{S}}^{-1}(p) \right], \quad i=1, \ldots, n.\]

Where \(K\) is the aggregate capital to be allocated, \(CTE_p[S] \) is the Conditional Tail Expectation of the aggregate loss at level \(p\), \(X_i\) is the individual loss, \(S\) is the aggregate loss and \( F_X^-1(p)\) is the quantile function of \(X\) at level \(p.\)

Value

A vector containing the optimal capital allocation, if Capital is set to 1, then the returned matrix will consist of the proportions of capital each individual loss needs to be optimally faced.

Author(s)

Jilber Urbina

References

Dhaene J., Tsanakas A., Valdez E. and Vanduffel S. (2011). Optimal Capital Allocation Principles. The Journal of Risk and Insurance. Vol. 00, No. 0, 1-28.

Urbina, J. (2013) Quantifying Optimal Capital Allocation Principles based on Risk Measures. Master Thesis, Universitat Politècnica de Catalunya.

Urbina, J. and Guillén, M. (2014). An application of capital allocation principles to operational risk and the cost of fraud. Expert Systems with Applications. 41(16):7023-7031.

See Also

hap, cap

Examples

data(dat1, dat2)
Loss <- cbind(Loss1=dat1[1:400, ], Loss2=unname(dat2))
# Proportions of capital to be allocated to each bussines unit
Overbeck2(Loss, Capital=1)

# Capital allocation,
# capital is determined as the empirical VaR of the losses at 99\%
K <- quantile(rowSums(Loss),  probs = 0.99)
Overbeck2(Loss, Capital=K)

Risk

Description

Risk measures such as Value at Risk (VaR) and Expected Shortfall (ES) with normal and t-student distributions based on variance-covariance method. It is a shortcut for VaR and ES.

Usage

Risk(
  variance,
  alpha = 0.95,
  measure = c("both", "VaR", "ES"),
  weights = NULL,
  model = c("both", "normal", "t-student"),
  df = NULL,
  percentage = FALSE
)

Arguments

variance

It could be either a scalar or a matrix containing the variances and covariances of the losses. Provide a covariance matrix when analyzing correlated losses or a scalar when dealing with a single loss.

alpha

The confidence level at which either the VaR or the ES will be computed, by default alpha is set to 0.95.

measure

An optional character string giving a measure for computing the risk. "VaR" stands for Value at Risk, "ES" stands for Expected Shortfall, and if both is chosen, then the function returns both the VaR and the ES as a result. By default measure is set to be "both".

weights

A vector containing the weights. It is only needed if variance is a matrix, if it is not then weights is set to 1.

model

A character string indicating which probability model has to be used for computing the risk measures, it could only be a normal distribution or a t-student distribution with \(v\) degrees of freedom. The normal distribution is the default model for this function. model default value is set to 'both' to show normal and t-student VaR and ES. See example below.

df

An integer (df>2) denoting the degrees of freedom, only required if model='t-student'. Otherwise it has to be NULL.

percentage

Logical indicating whether the file names in the VaR table should be presented in percentage or decimal.

Value

A data.frame containing each risk measure at its corresponding confidence level.

Author(s)

Jilber Urbina

References

Dhaene J., Tsanakas A., Valdez E. and Vanduffel S. (2011). Optimal Capital Allocation Principles. The Journal of Risk and Insurance. Vol. 00, No. 0, 1-28.

Urbina, J. (2013) Quantifying Optimal Capital Allocation Principles based on Risk Measures. Master Thesis, Universitat Politècnica de Catalunya.

Urbina, J. and Guillén, M. (2014). An application of capital allocation principles to operational risk and the cost of fraud. Expert Systems with Applications. 41(16):7023-7031.

See Also

VaR, ES

Examples

# Reproducing Table 2.1 in page 47 of
# McNeal A., Frey R. and Embrechts P (2005).
alpha <- c(.90, .95, .975, .99, .995)
(Risk(variance=(0.2/sqrt(250))^2, alpha=alpha, measure='both', model='both', df=4))*10000

# only VaR results
(Risk(variance=(0.2/sqrt(250))^2, alpha=alpha, measure='VaR', model='both', df=4))*10000


# only SE based on a 4 degrees t-student.
(Risk(variance=(0.2/sqrt(250))^2, alpha=alpha, measure='ES', model='t-student', df=4))*10000

Value at Risk

Description

Analytical approach for calculating VaR based on Variance-Covariance Method based on both normal and t-student distribution.

Usage

VaR(
  variance,
  alpha = 0.95,
  weights = NULL,
  model = c("normal", "t-student", "both"),
  df = NULL,
  percentage = FALSE
)

Arguments

variance

It could be either a scalar or a matrix containing the variances and covariances of the losses. Provide a covariance matrix when analyzing correlated losses or a scalar when dealing with a single loss.

alpha

The confidence level at which either the VaR will be computed, by default alpha is set to 0.95.

weights

A vector of weights of size N for weighting the variance of losses. When weights=NULL, variances used to compute VaR are the original values supplied to variance with no weighting scheme.

model

A character string indicating which probability model has to be used for computing the risk measures, it could be a normal distribution or a t-student distribution with \(v\) degrees of freedom. The normal distibution is the default model for this funcion. model also allows the user to set 'both' if she wishes both normal and t-student VaR or ES depending on what she choses in measure. See example below.

df

An integer (df>2) denoting the degrees of freedom, only required if model='t-student'. Otherwise it has to be NULL.

percentage

Logical indicating whether the file names in the VaR table should be presented in percentage or decimal.

Value

A data.frame containing the VaR at its corresponding confidence level.

Author(s)

Jilber Urbina

References

Dhaene J., Tsanakas A., Valdez E. and Vanduffel S. (2011). Optimal Capital Allocation Principles. The Journal of Risk and Insurance. Vol. 00, No. 0, 1-28.

Urbina, J. (2013) Quantifying Optimal Capital Allocation Principles based on Risk Measures. Master Thesis, Universitat Politècnica de Catalunya.

Urbina, J. and Guillén, M. (2014). An application of capital allocation principles to operational risk and the cost of fraud. Expert Systems with Applications. 41(16):7023-7031.

See Also

Risk, ES

Examples

# Reproducing VaR from Table 2.1 in page 47 of
# McNeal A., Frey R. and Embrechts P (2005).

alpha <- c(.90, .95, .975, .99, .995)
VaR(variance=(10000*0.2/sqrt(250))^2, alpha=alpha, model='both', df=4)

# only normal VaR results
VaR(variance=(10000*0.2/sqrt(250))^2, alpha=alpha)