# Implementation of CoVaR (a systemic risk measure) in R

I'm trying to estimate CoVaR using bivariate DCC GARCH in R. The concept of CoVaR is the dependence adjusted of VaR, which was first introduced by Adrian and Brunnermeier (2011). However, this original definition of CoVaR presented some limitations, which called for a modified version proposed by Girardi and Tolga Ergun (2013). For given confidence levels $\alpha$ and $\beta$,

$$Pr(X_t^i \leq CoVaR_{\beta,t}^{i|j} \,|\,X_t^j \leq VaR_{\alpha,t}^j ) = \beta.$$

Girardi et al. suggests a three-step procedure is used to estimate CoVaR.
Step 1: VaR of each institution $i$ is obtained by estimating a univariate GARCH (1,1) models for each time period. (This part I already know how to do using the package rugarch -- make forecast return and volatility and find the quantile.)
Step 2: For the return of institution $i$ and $j$, set up a bivariate GARCH model with DCC specification to estimate the pdf of $(X^i,X^j)$. (I'm also fine with this part -- I know how to solve for the parameters using the rmgarch package.)
Step 3: If we start from the definition of $CoVaR^{i|j}_{\beta,t}$ above, by definition $Pr(X_t^i \leq VaR_{\alpha,t}^i ) = \alpha$ so $$Pr(X_t^i \leq CoVaR_{\beta,t}^{i|j} \,,\,X_t^j \leq VaR_{\alpha,t}^j )=\alpha\beta.$$ Once $VaR_{\alpha,t}^i$ and pdf of $(X^i,X^j)$ have been estimated in previous two steps, CoVaR can be obtained by numerically solving the equation, $$\int_{-\infty}^{CoVaR_{\beta,t}^{i|j}}\int_{-\infty}^{VaR_{\alpha,t}^{i|j}}f_t(X^i , X^j )dxdy=\alpha\beta,$$ where $f_t(X^i , X^j)$ is the bivariate density of $(X^i,X^j)$.

This is the part that got me stumped. How can I obtain the bivariate density from the DCC GARCH parameters? And after I have the density figured out, how can I solve for the integral bound to get CoVaR?
Any input is appreciated, thanks!

References
1. Tobias Adrian and Markus K. Brunnermeier. CoVaR. Technical report, National Bureau of Economic Research, 2011.
2. Giulio Girardi and A. Tolga Ergun. Systemic risk measurement: Multivariate GARCH estimation of CoVaR. Journal of Banking & Finance, 37(8):3169–3180, 2013.

• Sorry, I accidentally posted this as an answer, it should be a comment.. I am not sure whether I get your question correct, and I am not an expert on that field. However, as you already know how solve for the DCC-Garch parameters you can easily sample from (x,y) conditional on the Garch-parameters (this is equivalent to sample from a bivariate normal with given parameters). Given this sample you can solve the Integral nummerically via Monte-Carlo...does this make sense? – muffin1974 Jan 8 '16 at 17:12
• I'm currently facing the same issue. Were you able to implement it? Regards, Richard – Richard May 30 '16 at 19:14
• @Richard: Sort of. For each VaR I defined a function using mvtnorm and then solved for CoVaR with uniroot. But it was not numerically stable so in the end I switched to copula. – drawar May 31 '16 at 7:06