How to Find a Linear Regression Equation

Regression analysis is used to find equations that fit data. Once we have the equation, we can use the statistical model to make predictions. One type of regression analysis is linear analysis. When a correlation coefficient shows that data is likely to be able to predict future outcomes and a scatter graph of the data appears to form a straight line, statisticians may use linear regression to find a predictive function. If you recall from elementary algebra, the equation for a line is y = mx + b. This article shows you how to take data, calculate linear regression, and find the equation y’ = a + bx.

Step 1: Make a chart of your data, filling in the columns in the same way as you would fill in the chart if you were finding the Pearson’s Correlation Coefficient.

Subject Age x Glucose Level y xy x2 y2
1 43 99 4257 1849 9801
2 21 65 1365 441 4225
3 25 79 1975 625 6241
4 42 75 3150 1764 5625
5 57 87 4959 3249 7569
6 59 81 4779 3481 6561
Σ 247 486 20485 11409 40022

From the above table, Σx = 247, Σy = 486, Σxy = 20485, Σx2 = 11409, Σy2 = 40022. n is the sample size (6, in our case).

Step 2: Use the following equations to find a and b.
linear regression equations

a = 553,794
b = .385225

Click here if you want easy, step-by-step instructions for solving this formula.

Find a:

  • ((486 × 11,409) – ((247 × 20,485)) / 6 (11,409) – 2472)
  • 5,544,774 – (5,059,795 / 7,445)
  • =553,794

Find b:

  • (6(20,485) – (247 × 486)) / (6 (11409) – 2472)
  • (122,910 – 120,042) / 68,454 – 2472
  • 2,868 / 7,445
  • = .385225

*/ ?>

Step 3: Insert the values into the equation.
y’ = a + bx
y’ = 553,794 + .385225x

That’s it!

* Note that this example has a low correlation coefficient, and therefore wouldn’t be too good at predicting anything.

Related posts:

  1. How to Find a Linear Regression Slope
  2. How to Compute a Linear Regression Test Value
  3. How to Perform a TI 83 Linear Regression
  4. How to Perform Linear Regression on the TI-89 calculator in Under a Minute!
  5. How to Compute Pearson’s Correlation Coefficients
Feel like Cheating at Statistics? This is the Statistics Handbook that your professor doesn't want you to see. So easy, it's Practically Cheating. Find out more »

17 Responses to “How to Find a Linear Regression Equation”

  1. How to Do Everything Statistics » How to Find a Linear Regression Slope said:

    Nov 06, 09 at 5:53 am

    [...] If formulas scare you, you can find more comprehensive instructions on how to work the formula in this article on how to find a linear regression equation. [...]

  2. Kimble said:

    Nov 06, 09 at 4:29 pm

    Hei!

    Let’s say I’ve plotted y in a scatter plot to make some prediction. I know that it’s possible to find functions indicating the “upper and lower” bound for y for a given x with a given percent certainty.

    I’ve done some statistics in Norwegian, but I’m not sure about the English term for this. Hope someone understood what I’m trying to do.

    Thanks!

  3. Stephanie said:

    Nov 07, 09 at 5:52 am

    Kimble, What you are describing is linear regression — I think you’re thinking of confidence interval. Stephanie

  4. Lauren Schultz said:

    Nov 12, 09 at 11:45 am

    Your explination was very helpful. I kept messing up when i put it into the calculator. I had to redo it over and overto get the answer in the ex then follow that process in my problem…

  5. Lisa Barcomb said:

    Nov 12, 09 at 7:28 pm

    These questions were somewhat difficult but I tried to do my best and hopefully I will understand them as I take my test. Some of this information is not sinking in my head for some reason. I know I will never take a class like this again on line.

  6. Donna Allen said:

    Nov 13, 09 at 1:57 am

    I have to agree with Lisa that I wouldn’t take another math class online. Math is not my strong suit. And, I realize now that I should have been in a classroom setting where I could ask questions face to face. This blog has been very helpful. But, unfortunately it doesn’t make up for my lack of math skills.

  7. Mary Johnson said:

    Nov 29, 09 at 3:46 pm

    I was having trouble in chapter nine with the correlation coefficient, I couldn’t come up with the same answer as Math Zone using the formula to solve for r. The problems don’t show a square route in the denominator but the link to text does. I don’t know if my skills are lacking so much that I just didn’t know that but why would it show it in the text?

  8. Stephanie said:

    Dec 01, 09 at 2:41 am

    There is a square root: Mathzone is missing it in a couple of the questions.

  9. Kalynn Grabau said:

    Dec 02, 09 at 10:03 am

    That’s what it is. Mathzone doesn’t explain that to solce for r, you need to square root it. Now, I’m getting it, but before I was so confused. Thanks for this!

  10. Donna Allen said:

    Dec 02, 09 at 7:32 pm

    I found this information very helpful and easy to follow. Compared to chapter 8, so far this has been a breeze.

  11. Donna Allen said:

    Dec 05, 09 at 12:08 am

    Thank you for posting it on the main blackboard page that the square root was missing. This saved a lot of time and headache.

  12. Tammy Sutton said:

    Dec 07, 09 at 3:35 pm

    On this one I found it easier (yes I know lazier) to put it into my calculator. It took me a while to remember how to use my calculator, but once I remembered, I got it down. I’m not sure if there is a part on this site that would give some directions on how to use our calculators for these problems?

  13. Vanessa DuBarry said:

    Dec 10, 09 at 5:44 pm

    This blog was very helpful and it was very easy to follow, I agree with the others that taking math online is way more difficult, but thanks to this blog its a little bit easier.

  14. AshleyB said:

    Feb 20, 10 at 6:30 am

    Hey guys,

    I’m from the better USA! and I think I found a new spot to hangout

    So, anyone care about the Olympic Games?

  15. Alison Bryant said:

    Apr 26, 10 at 12:16 pm

    I found this aspect fairly easy once I got the equation down. However, I also realized that you can use the linreg function on the calculator and get the same answer.

  16. Athar said:

    May 25, 10 at 10:52 pm

    so i tried using the linreg2 function: as in, A=linreg2(x,y), given both x and y.
    sooo what should that tell me. coz im running this in matlab and it doesnt seem to know what it is?!?!?

  17. math for kids said:

    Nov 24, 11 at 12:56 pm

    math for kids…

    [...]Statistics How To» Blog Archive » How to Find a Linear Regression Equation[...]…


Leave a Reply