[R-SIG-Finance] Value of risk (system) conditional the event bank=value at risk level

schloni stu99005 at mail.uni-kiel.de
Sat Oct 5 15:55:24 CEST 2013


Dear R-community,

I try to calculate the Value at risk (VaR) of the financial system
conditional the event, that a single bank is on its VaR-level. This is then
called the CoVaR.

The VaR is the 95%-(negative)quantile of a distribution, so it can be
calculated using the rq() regression function.

My first version of the code is shown below. However, it did not work,
because the VaR of the bank is a single value e.g. -0.0038974, but the
weighted average is a vector of 3130 numbers. Furthermore, this approach is
somehow logically wrong, as it should be more like this:

CoVaR <- rq(Xsystem~X, tau=0.05, if X=VaR(X, p = 0.95, method =
c("historical"))) or

CoVaR <- rq(Xsystem~X, tau=0.05, if X=VaRbankq)

Has anybody an idea, how I can solve this?

Thanks a lot!


This is my code:

# PAKETE
sessionInfo()
library(quantreg)                   
library(PerformanceAnalytics)           

# LADEN DER DATEN
weightssystem<-read.csv("systemweightedaveragegrowthrate.csv")# growth rate
total assets ofsystem
x <- read.csv("growthrateMVtotalassetsbank2.csv")                     #
growth rate of total assets of bank2

# DEFINITION
Xsystem <- weightssystem[,1]
X <- x[,1]
length(Xsystem)                                                                         
# length is 3130
length(X)                                                                                   
# length is 3130

# VaR BANK
# 2 Methods
VaRbankq <- quantile(X, 0.05)                                          # 
calculation via the 95%-quantile
VaRbankq
VaRbank <- VaR(X, p = 0.95, method = c("historical"))       #  VaR-function;
gaussian possible
VaRbank 


# VaR SYSTEM CONDITIONAL ON EVENT (BANK=VaR LEVEL): CoVaR
CoVaR <- rq(Xsystem~VaRbank, tau=0.05)                          # this was
my first try            
CoVaR



--
View this message in context: http://r.789695.n4.nabble.com/Value-of-risk-system-conditional-the-event-bank-value-at-risk-level-tp4677672.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list