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 7670075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:44:21+00:00 2026-05-31T15:44:21+00:00

i have a problem doing the linear regression with three Matrix objects. m1 =

  • 0

i have a problem doing the linear regression with three Matrix objects.

m1 = matrix(c(1:10))
m2 = matrix(c(10:19))
m3 = matrix(c(100:109))

I DO NOT have problem if i do:

mod = lm(m1+m2 ~ m3+0)

I have the problem if i only use TWO Matrixs, like:

m1 = matrix(c(1:20), ncol=2)
m2 = matrix(c(1:10))

mod = lm(m1 ~ m2+0)

in this case i get TWO coefficients for m2:

Coefficients:
    [,1]   [,2] 
m2  1.000  2.429

but I do not want it I would like that the two columns of the m1 matrix will be as the previous example (like two distinct columns)

How to do it?

  • 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-05-31T15:44:23+00:00Added an answer on May 31, 2026 at 3:44 pm

    In your first example you are summing your two column vectors row-wise together and using that as the target. For the matrix m1 I think you want the rowsums as the predictor.

    like:

    m1 = matrix(c(1:2000), ncol=200)

    m2 = matrix(c(1:10))

    msum=apply(m1,1,sum)

    now use msum for your response.

    mod = lm(msum ~ m2+0)

    This gives just one coeficient. I think this is what you want, but I am still not sure why you would want this?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone help, i have problem doing a sort, I thought i had it
i have strange problem doing reporting: i have numerous clients with different issued invoices.
I have narrowed down my problem to the mysql_connect call I am doing in
While doing some small regex task I came upon this problem. I have a
I have a problem building applicatin with tabBarController. There is no problem doing tabBarController
The Facebook connect code is eluding me a bit. I have no problem doing
I'm doing an assignment about planning for tower of Hanoi problem using linear planning
I have a problem doing a query with my software... I have a function
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with return statment >.< I want to store all magazine names

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.