[R-SIG-Finance] Value-at-risk
sadako
guillaume.kovarcik at gmail.com
Sun Jun 19 19:20:30 CEST 2011
sadako wrote:
>
>
>
>> 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...
>
I think we don't get the same univariate portfolio VaR with the two
portfolio_method "marginal" and "component" because of :
- in PerformanceAnalytics:::VaR.Marginal, the Return.portfolio are
calculated without the optional argument geometric (geometric=FALSE would
eventually match the stdev I compute).
- in PerformanceAnalytics:::VaR.Marginal, when calling the
portfolio_method="single" to compute the univariate portfolio VaR, we end up
in the PerformanceAnalytics:::VaR.Gaussian function.
This function uses the PerformanceAnalytics:::centeredmoment function, which
uses the mean function.
This does not give the same variance as stdev for instance since there's not
the ajustement of the estimator (division by n-1 instead of n if data set
has n observations).
If we set m2 = centeredmoment(r, 2)*dim(r)[1]/(dim(r)[1]-1), it looks ok.
With these two modifications, I have the impression the univariate portfolio
VaR computed from portfolio_method="marginal" and
portfolio_method="component" are consistant.
--
View this message in context: http://r.789695.n4.nabble.com/Value-at-risk-tp3516991p3609604.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance
mailing list