On R version 2.15.2, while using the ES function in PerformanceAnalytics:
ES(R=indexes, weights=w)
I get the following error:
Error in t(w) %*% M3 : requires numeric/complex matrix/vector arguments
where w is
[,1]
[1,] 0.5
[2,] 0.5
both is.matrix(w) and is.numeric(w) return TRUE
Calling the function without passing weights (i.e. ES(R=indexes) ) works.
How do I resolve this?
Using this edhec data (given with package) and the weights vector I can reproduce the error ( Please give a reproducible example next time, otherwise we will not be sure to give sense to the following answer)
The error because the M3 matrix is null. You need to change the argument
portfolio_methodfrom the defaultsingletocomponent. The help talk about weights in the Component ES part, so this make sense. Otherwise , I think you need to suplly m3,m4, mu…(painful)Try this