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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:22:14+00:00 2026-06-11T09:22:14+00:00

So I get a bit confused by the lm()-command. I tried it with lm(x~y,

  • 0

So I get a bit confused by the lm()-command. I tried it with lm(x~y, mydata) and lm(y~x, mydata) and I got different output.
So is that just which variable to use as x and which one to use as y? I’m sorry to ask such a noob question but I am not sure and I coulnd’t find anything explaining the parameters of that command!

  • 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-11T09:22:16+00:00Added an answer on June 11, 2026 at 9:22 am

    The answers can be found on the help page for the function. In the Details section we have:

    A typical model has the form response ~ terms where response is the (numeric) response vector and terms is a series of terms which specifies a linear predictor for response.

    There are more details (also linked to from the lm help page to formula. In the details sections for formula, we have:

    The ~ operator is basic in the formation of such models. An expression of the form y ~ model is interpreted as a specification that the response y is modelled by a linear predictor specified symbolically by model.

    So to summarize, you define your model in symbolic terms where the LHS is your response variable, and the RHS are your predictor variable(s). You get different answers because in one model, y is your response variable and the other is x.

    If you weren’t aware, you can access the help page for nearly all functions with ? at the command line, i.e. ?lm or ?formula.

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

Sidebar

Related Questions

Just wondering when do you actually use $.get(index); I am a bit confused on
I always get confused when I am about to use a bit map to
I am a bit confused, I have a bunch of elements that get added
When I look at apple docs, I get a bit confused. On one hand
Bit confused here, I have an on-demand instance but do I get charged even
Trying to get a bit more out of the command line: I have a
Was hoping I could get a bit of a hand on this login that
Scrollbars get quite a bit of use in the site i'm working on and
I'm a bit confused with the input's of Ruby. Whenever I try to get
I am a bit confused about how to implement EditorForModel. I get the idea

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.