Hi everyone (& Brian),

I have been using the excellent package PerformanceAnalytics with success.  
Yesterday I tried computing component and marginal VaR with the package on my 
data and I get an error with marginal VaR.  Component VaR is fine but marginal 
VaR fails with either the default even-weights or when I pass in a weight 
vector.  Below is a simple recreation of the error with EDHEC dataset.

Can somebody help with the marginal VaR calculation?  Thanks!

Henry


> data(edhec)
> VaR(edhec)
    Convertible Arbitrage  CTA Global Distressed Securities Emerging Markets 
Equity Market Neutral Event Driven
VaR           -0.03247395 -0.03380228           -0.02749240      -0.06363081    
       -0.01134637  -0.02812515
    Fixed Income Arbitrage Global Macro Long/Short Equity Merger Arbitrage 
Relative Value Short Selling
VaR             -0.0246791  -0.01548247       -0.03037494      -0.01486869    
-0.01926435   -0.07431463
    Funds of Funds
VaR    -0.02502852
> VaR(edhec, portfolio_method='component')
no weights passed in, assuming equal weighted portfolio
$MVaR
           [,1]
[1,] 0.01459739

$contribution
 Convertible Arbitrage             CTA Global  Distressed Securities       
Emerging Markets 
          2.167008e-03          -9.876816e-05           1.720857e-03           
3.691141e-03 
 Equity Market Neutral           Event Driven Fixed Income Arbitrage           
Global Macro 
          4.935426e-04           1.780578e-03           1.486652e-03           
9.209540e-04 
     Long/Short Equity       Merger Arbitrage         Relative Value          
Short Selling 
          1.784986e-03           6.778369e-04           1.324299e-03          
-3.150584e-03 
        Funds of Funds 
          1.798890e-03 

$pct_contrib_MVaR
 Convertible Arbitrage             CTA Global  Distressed Securities       
Emerging Markets 
           0.148451703           -0.006766151            0.117887954            
0.252863009 
 Equity Market Neutral           Event Driven Fixed Income Arbitrage           
Global Macro 
           0.033810326            0.121979204            0.101843703            
0.063090308 
     Long/Short Equity       Merger Arbitrage         Relative Value          
Short Selling 
           0.122281163            0.046435481            0.090721618           
-0.215831957 
        Funds of Funds 
           0.123233638 

> VaR(edhec, portfolio_method='marginal')
no weights passed in, assuming equal weighted portfolio
Error in `[.xts`(R, , names(weights)) : 'i' or 'j' out of range
> 



        [[alternative HTML version deleted]]

_______________________________________________
[email protected] 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.

Reply via email to