[prev in list] [next in list] [prev in thread] [next in thread]
List: r-sig-finance
Subject: Re: [R-SIG-Finance] Value of risk (system) conditional the event bank=value at risk level
From: Kris <kk2250 () optonline ! net>
Date: 2013-10-09 1:49:30
Message-ID: 7C9C332D-A8B9-4A18-B032-67BD4218DDF3 () optonline ! net
[Download RAW message or body]
It might help to see the data that you are loading but presumably you have daily data \
then you want to compute rolling VaR estimates (with say a 1yr lookback) with that \
data and then do the quantile regression.
On Oct 5, 2013, at 9:55 AM, schloni wrote:
> 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.
>
> _______________________________________________
> R-SIG-Finance@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic