[R-SIG-Finance] Specifying Portfolio Weights for VaR / Package PerformanceAnalytics

Gero Schwenk gero.schwenk at web.de
Wed Jul 21 14:21:18 CEST 2010


Hi together!
I've got a question regarding how to supply portfolio weights for VaR 
calculation - using PerformanceAnalytics. I got stuck working through 
the examples:

 > data(edhec)      # example data
 > data(weights)   # example weights
 > VaR(edhec, p=.95, method="historical", weights = weights)
Fehler in VaR.historical(R = R, p = p) %*% weights :
  verlangt numerische/komplexe Matrix/Vektor-Argumente

The error message translates to: "Error in VaR.historical(R = R, p = p) 
%*% weights :
requires numeric/complex Matrix/Vector-Arguments".

Weights is of type "xts", but forcing it to numeric or matrix doesn't 
solve the problem:

 > VaR(edhec, p=.95, method="historical", weights = as.numeric(weights))
Fehler in VaR.historical(R = R, p = p) %*% weights :
  verlangt numerische/komplexe Matrix/Vektor-Argumente

 > VaR(edhec, p=.95, method="historical", weights = as.matrix(weights))
Fehler in VaR.historical(R = R, p = p) %*% weights :
  verlangt numerische/komplexe Matrix/Vektor-Argumente

Does anybody have an idea what goes wrong?
Many thanks and kind regards:
Gero



More information about the R-SIG-Finance mailing list