# [R-SIG-Finance] Value-at-risk

Sun Jun 19 18:07:20 CEST 2011

```braverock wrote:
>
> On Sun, 2011-06-19 at 03:19 -0700, sadako wrote:
>> I'm ok with the notions of component and marginal VaR but can't retrieve
>> results from marginal.
>>
>> First what is the PortfolioVaR with the portfolio_method="marginal" ?
>> Except the sign, the 2 figures I get from these functions for
>> PortfolioVaR
>> are differents :
>> VaR(tsdata,method="gaussian",portfolio_method="marginal")
>> VaR(tsdata,method="gaussian",portfolio_method="component")\$VaR
>
> Marginal and component VaR *are* different.  So I'm not sure I
> understand what you're asking, entirely.
>
> Component VaR is a coherent risk measure per Artzner.  The component
> risks will add up to the univariate VaR of the entire portfolio.  The
> univariate portfolio VaR is given in the \$VaR slot you reference in your
> code.
>
> Marginal VaR is the difference between the univariate portfolio VaR of a
> a portfolio with the instrument in question and the VaR of the portfolio
> without that instrument.

Actually I didn't mean to compare marginal and component : I just use the
portfolio_method="component" to get the univariate VaR of the portfolio
(\$VaR slot).
I have the same number using calculation like
qnorm(0.95,0,1)*sqrt(t(wghts)%*%var(tsdata)%*%wghts)-t(wghts)%*%colMeans(tsdata).

I would have expect to have the same number for this univariate portfolio
VaR in the "PortfolioVaR" column of VaR(...,portfolio_method="marginal"), -
all other parameters being equal - but this is not the case.

Both should represent the univariate portfolio VaR aren't they ?

>> I tried the following but the result is different from the function (here
>> it
>> is the 5th marginal) :
>>
>> VaR(tsdata,method="gaussian",portfolio_method="component")\$VaR-VaR(tsdata[,-5],method="gaussian",portfolio_method="component")\$VaR
>
> Component VaR and marginal VaR aren't interchangeable, as described
> above, and as described in the documentation.
>
> simple subtraction doesn't work, because the portfolio (capital) needs
> to be redistributed.
>
> The weighting factor is
>
> weightfactor = sum(weightingvector)/sum(t(weightingvector)[, -column])
>

Nota : here again I just use the \$VaR slot of component to get access to the
univariate VaR of portfolio.

I think I got the weight factor right implicitly since I don't set any
special weights vectors : the VaR functions sets these weights equally in
both members of my equation.

Assume I'm working with 5 assets :
- the univariate VaR of the portfolio :
VaR(tsdata,method="gaussian",portfolio_method="component")\$VaR is computed
with default weights=c(0.2,0.2,0.2,0.2,0.2)
- the VaR of the portfolio without the asset 5 :
VaR(tsdata[,-5],method="gaussian",portfolio_method="component")\$VaR is
computed with equally-weighted default weights=c(0.25,0.25,0.25,0.25). These
are indeed the weights of the 5-assets portfolio taking into account the
weight factor of sum(weightingvector)/sum(t(weightingvector)[, -5])=1.25

Marginal VaR is the difference between the univariate portfolio VaR of a
> a portfolio with the instrument in question and the VaR of the portfolio
> without that instrument.

So with no weight specification, the stricto-sensu calculation :

VaR(tsdata,method="gaussian",portfolio_method="component")\$VaR-VaR(tsdata[,-columnAsset],method="gaussian",portfolio_method="component")\$VaR

should work or this is non-sense ?

> you can see the code with: PerformanceAnalytics:::VaR.Marginal
>

I'm having a look, maybe the difference stems from the application of
Return.portfolio in the marginal case...

>> Many thanks for any helpful comment,
>
> I hope this helps,
>     - Brian
>

It did, thank you very much Brian !

--
View this message in context: http://r.789695.n4.nabble.com/Value-at-risk-tp3516991p3609482.html
Sent from the Rmetrics mailing list archive at Nabble.com.

```