Package 'riskSimul'

Title: Risk Quantification for Stock Portfolios under the T-Copula Model
Description: Implements efficient simulation procedures to estimate tail loss probabilities and conditional excess for a stock portfolio. The log-returns are assumed to follow a t-copula model with generalized hyperbolic or t marginals.
Authors: Wolfgang Hormann [aut, cre], Ismail Basoglu [aut]
Maintainer: Wolfgang Hormann <[email protected]>
License: GPL-2 | GPL-3
Version: 0.1.2
Built: 2024-12-24 06:32:29 UTC
Source: CRAN

Help Index


Risk Quantification for Stock Portfolios under the T-Copula Model

Description

This package can estimate the tail loss probabilities and conditional excess for a stock portfolio. The log-returns are assumed to follow a t-copula model with generalized hyperbolic or t marginals.

Details

To simulate the tailloss probabilities of a portfolio for which the parameters of the t-copula model with generalized hyperbolic or t marginals are available the following two functions can be used.

SISTCopula() is the name of the function that uses stratified importance sampling (SIS) to estimate a single or several tailloss probabilities and the corresponding conditional excess in a very efficient way.

NVTCopula() estimates the same quantities using naive simulation (without variance reduction).

Author(s)

Wolfgang Hormann, Ismail Basoglu

References

I Basoglu, W Hormann. 2014. Efficient stratified sampling implementations in multiresponse simulation, in: Proceedings of the 2014 Winter Simulation Conference A. Tolk, S. Y. Diallo, I. O. Ryzhov, L. Yilmaz, S. Buckley, and J. A. Miller, eds.

I Basoglu, W. Hormann, and H. Sak. 2013. Optimally Stratified Importance Sampling for Portfolio Risk with Multiple Loss Thresholds. Optimization 62 (11): 1451-1471

Examples

R<- matrix(
c(1, 	0.554, 	0.632, 	0.419, 	0.400, 
  0.554,1, 		0.495, 	0.540, 	0.479,
  0.632,0.495, 	1, 		0.426, 	0.445,
  0.419,0.540, 	0.426, 	1, 		0.443,
  0.400,0.479, 	0.445, 	0.443, 	1),ncol=5)
  
pmg<- matrix(NA,ncol=5,nrow=5)  
colnames(pmg) <- c("lambda","alpha","beta","delta","mu")
pmg[1,] <- c(-0.602828, 8.52771, -0.533197, 0.014492, -0.000091)
pmg[2,] <- c(-1.331923, 2.72759, -2.573416, 0.019891, 0.001388)
pmg[3,] <- c(-1.602705, 3.26482, 1.456542, 0.035139, -0.001662)
pmg[4,] <- c(-1.131092, 15.13351, -1.722396, 0.014771, 0.001304)
pmg[5,] <- c(-0.955118, 31.14005, 0.896576, 0.015362, -0.000238)
 
portfo <- new.portfobj(nu=8.195,R=R,typemg="GH",parmg=pmg,c=rep(1,5),w=rep(0.2,5))

res1<- SISTCopula(n=10^4,npilot=c(10^3,3*10^3),portfobj=portfo,threshold=c(0.97,0.96,0.95,0.94),
                  stratasize=c(22,22),CEopt=FALSE,beta=0.75,mintype=0)

Efficient tail-loss probability and conditional excess estimation for t-copula model

Description

Using stratified importance sampling (SIS) or naive simulation (NV) the tail-loss probabilities and conditional excess values for several threshold values are estimated for a stock portfolio. The logreturns of the stocks are assumed to follow a t-copula model with generalized hyperbolic or t marginals.

Usage

SISTCopula(n=10^5,npilot=c(10^4,2*10^4),portfobj,threshold=c(0.95,0.9),
           stratasize=c(22,22),CEopt=FALSE,beta=0.75,mintype=-1)

NVTCopula(n=10^5,  portfobj, threshold=c(0.95,0.9))

new.portfobj(nu,R,typemg="GH",parmg,c=rep(1,dim(R)[1]),w=c/sum(c))

Arguments

n

total sample size

npilot

size of one or several pilot runs, the sum of them should be smaller than n/2

portfobj

object of portfolio parameters

threshold

one or several threshold values (they should be ordered)

stratasize

a vector of length two holding the number of strata

CEopt

TRUE ... minimize the overall error of Conditional Exess estimates, otherwise of tail-loss estimates

beta

weight of maximal threshold value used for calculating the intermediate threshold used for selecting the IS density, only used when length(threshold)>1

mintype

only used when length(threshold)>1; 0 ... minimize mean square errors, -1 ... minimize relative MSE, -2 ... minimize the maximal error, -3 minimize the maximal relative error; a positive integer j indicates that the variance of the estimate for the j-th threshold is minimized.

nu

degrees of freedom of the t-copula

R

correlation matrix of the t-copula

typemg

type of the marginal distribution, "GH" generalized hyperbolic distribution, "t" t-distribution

parmg

matrix holding in its rows the parameters of the marginal distribution; for the generalized hyperbolic distribution each row holds the parameters lambda, alpha, beta, delta and mu; for the t-distribution each row holds the parameters mu, sigma and nu (degrees of freedom).

c

scale factor vector of the portfolio

w

portfolio weights

Value

For the case that the variable threshold contains only one value a matrix containing the results for the tail-loss probability in the first row and that of the conditional excess in the second row is returned.

In the case that several threshold values are considered, a list consisting of the result matrices for tail-loss probabilities and for conditional excess and the vector of the threshold values is returned.

Author(s)

Ismail Basoglu, Wolfgang Hormann

Examples

R<- matrix(
c(1, 	0.554, 	0.632, 	0.419, 	0.400, 
  0.554,1, 		0.495, 	0.540, 	0.479,
  0.632,0.495, 	1, 		0.426, 	0.445,
  0.419,0.540, 	0.426, 	1, 		0.443,
  0.400,0.479, 	0.445, 	0.443, 	1),ncol=5)
  
pmg<- matrix(NA,ncol=5,nrow=5)  
colnames(pmg) <- c("lambda","alpha","beta","delta","mu")
pmg[1,] <- c(-0.602828, 8.52771, -0.533197, 0.014492, -0.000091)
pmg[2,] <- c(-1.331923, 2.72759, -2.573416, 0.019891, 0.001388)
pmg[3,] <- c(-1.602705, 3.26482, 1.456542, 0.035139, -0.001662)
pmg[4,] <- c(-1.131092, 15.13351, -1.722396, 0.014771, 0.001304)
pmg[5,] <- c(-0.955118, 31.14005, 0.896576, 0.015362, -0.000238)
 
portfo <- new.portfobj(nu=8.195,R=R,typemg="GH",parmg=pmg,c=rep(1,5),w=rep(0.2,5))

res1<- SISTCopula(n=10^4,npilot=c(10^3,3*10^3),portfobj=portfo,threshold=c(0.97,0.96,0.95,0.94),
                  stratasize=c(22,22),CEopt=FALSE,beta=0.75,mintype=0)
 res1
 SISTCopula(n=10^4,npilot=c(10^3,3*10^3),portfobj=portfo,threshold=0.94,
            stratasize=c(22,22),CEopt=FALSE)

 NVTCopula(n=10^4,portfobj=portfo,threshold=c(0.97,0.96,0.95,0.94))
 NVTCopula(n=10^4,portfobj=portfo,threshold=0.94)

########
# example with t-marginals

R<- matrix(
c(1, 	0.551, 	0.636, 	0.421, 	0.398, 
  0.551,1, 	0.496, 	0.540, 	0.477,
  0.636,0.496, 	1, 	0.428, 	0.447,
  0.421,0.540, 	0.428, 	1, 	0.444,
  0.398,0.477, 	0.447, 	0.444, 	1),ncol=5)
   

pmg<- matrix(NA,ncol=3,nrow=5)  
colnames(pmg) <- c("mu","sigma","nu")
pmg[1,] <- c(-0.000258, 0.013769, 1.78)
pmg[2,] <- c(0.000794, 0.012166, 2.64)
pmg[3,] <- c(-0.000837, 0.019616, 3.25)
pmg[4,] <- c(0.001041, 0.009882, 2.67)
pmg[5,] <- c(-0.000104, 0.010812, 3.10)

portfo <- new.portfobj(nu=7.525,R=R,typemg="t",parmg=pmg,c=rep(1,5),w=rep(0.2,5))

res1<- SISTCopula(n=10^4,npilot=c(10^3,3*10^3),portfobj=portfo,threshold=c(0.97,0.96,0.95,0.94),
                  stratasize=c(22,22),CEopt=FALSE,beta=0.75,mintype=0)
res1
SISTCopula(n=10^4,npilot=c(10^3,3000),portfobj=portfo,threshold=0.94,stratasize=c(22,22))

NVTCopula(n=10^4,portfobj=portfo,threshold=c(0.97,0.96,0.95,0.94))
NVTCopula(n=10^4,portfobj=portfo,threshold=0.94)