# [R-SIG-Finance] Incremental and Component VaR

Joe W. Byers Joe-Byers at utulsa.edu
Wed Dec 6 16:55:16 CET 2006

```Brian,

It looks like you are trying to calculate Marginal VAR (using
riskmetrics' definition of marginal VAR) You should checkout riskmetrics
riskmetrics - the evolution of a standard has IVAR calculations there.
They specify IVAR = weights * the gradiant of the VAR with respect to
the weights or
w(i) * partial (VAR/w(i))  This is equation 6.10.  Their equation 6.14
give the calculation of the gradient as
-z{ Covariance Matrix * weights vector) / sqrt(t(weights) * covariance
matrix * weights)} where z is the VAR alpha level.  Mutiply this term by
the weights vector and you get a vector of IVAR's where the sum of the
vector is equal to VAR.  Their documentation seems to imply that you
have to calculate IVAR as a separate function meaning you do not call a
VAR calc on the sub portfolio as you do in your code.

I should also point out that VAR definitions are not consistent in the
literature.  Jorion's VAR book and the riskmetrics documentation differ
in incremental VAR and mariginal VAR definitions.  IVAR in Jorion is
Marginal VAR in riskmetrics and IVAR in riskmetrics is component VAR in
Jorion for example.

Please let me know how it is going.

Good Luck
Joe W. Byers
Professor of Finance
The University of Tulsa

Brian G. Peterson wrote:
> I have previously posted several functions for analysis of the higher
> moments of a returns distribution here:
>
> http://braverock.com/brian/R/extra_moments.R
>
> including a function to calculate modified Cornish-Fisher VaR.
>
> I've intermittently tried to implement Incremental (or Component) VaR.
>
> I could really use some help debugging this function.  In Incremental VaR,
> the Incremental VaR of each component of the portfolio should all add up
> to the total VaR of the portfolio.  Several papers suggest that this
> should work with either traditional (RiskMetrics) VaR or with modified
> Cornish-Fisher VaR.
>
> Unfortunately, I can't get it to work with either VaR calculation, so I
> must have an error in my logic somewhere.
>
> Help would be greatly appreciated in fixing this function.  My
> IncrementalVaR function begins on line 610 of the referenced
> extra_moments.R file
>
> Thanks in advance for any assistance.
>
> Regards,
>
>   - Brian
>
>
> Ref:
>
> Incremental and Component VaR is described many places in the literature,
> including:
> Beyond the VaR Horizon, Gaussel, et. al.
> http://www.mathfin.com/nicolas/Q37.pdf
>
> Incremental, Marginal, and Component VaR, 2004, Denton and Jayaraman
> http://www.sungard.com/products_and_services/energy/variantsofvar1.pdf
>
> extra_moments.R
> http://braverock.com/brian/R/extra_moments.R
>

```