Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:11:26+00:00 2026-06-17T22:11:26+00:00

On R version 2.15.2, while using the ES function in PerformanceAnalytics: ES(R=indexes, weights=w) I

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:11:26+00:00Added an answer on June 17, 2026 at 10:11 pm

    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)

    weights <- c(0.2, 0.2, 0.1, 0.1, 0.5)       ## must be to number of columns in R"
    ES(R = edhec[,1:5], weights= weights)
    Error in t(w) %*% M3 : requires numeric/complex matrix/vector arguments
    

    The error because the M3 matrix is null. You need to change the argument portfolio_method from the default single to component. 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

    ES(R = edhec[,1:5], weights= weights,
           portfolio_method= 'component')
    
    $MES
              [,1]
    [1,] 0.0331994
    
    $contribution
    Convertible Arbitrage            CTA Global Distressed Securities      Emerging Markets Equity Market Neutral 
              0.015504952          -0.006116166           0.004702236           0.007760899           0.011347477 
    
    $pct_contrib_MES
    Convertible Arbitrage            CTA Global Distressed Securities      Emerging Markets Equity Market Neutral 
                0.4670251            -0.1842252             0.1416362             0.2337662             0.3417977 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error while using twitter bootstrap. I didn't get this error
I'm using the following function to get a JSON Array from a php webpage.
I have been using Git for my version control for a while now, but
I am using Hibernate 3 version for my Application . While going through tutorials
I'm using the following to define root while in development: define('LOCAL_URL', 'http://localhost/~xampp/Mysite'); define('REMOTE_URL', 'http://example.com');
I am using the pandas.ols function from version 0.7.3. I seem to be getting
While using the re module in ipython I noticed an undocumented template function: In
While my ASP.NET project uses version 3.5 of the framework , the event log
I've tried to find the 64bit version for pysvn for a while now. The
In Visual Studio 2010, while creating new projects, we may select target version to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.