Loading...
1

Linear Regression Calculator

Perform linear regression to find relationships between variables. Input data points to calculate the best-fit line, essential in statistics, economics, and scientific research.

Explanation of How the Slope and Intercept Are Calculated

Linear regression is used to model the relationship between two variables. The formula for a straight line is:

y = mx + b

  • m: The slope of the line, which indicates how much y changes for each unit change in x.
  • b: The y-intercept, which is the value of y when x = 0.

The slope (m) and intercept (b) are calculated using the following formulas:

  • Slope (m):
    m = (NΣxy - ΣxΣy) / (NΣx⊃2; - (Σx)⊃2;)
  • Intercept (b):
    b = (Σy - mΣx) / N

Where:

  • N is the number of data points.
  • Σxy is the sum of the product of corresponding values of x and y.
  • Σx and Σy are the sums of x and y values, respectively.
  • Σx⊃2; is the sum of the squares of the x values.

 

Linear Regression Examples and Solutions

Example 1:

X values: 1, 2, 3, 4, 5

Y values: 2, 4, 6, 8, 10

Solution: Slope (m) = 2, Intercept (b) = 0

Example 2:

X values: 1, 3, 5, 7, 9

Y values: 2, 6, 10, 14, 18

Solution: Slope (m) = 2, Intercept (b) = 0

Example 3:

X values: 2, 4, 6, 8, 10

Y values: 1, 3, 5, 7, 9

Solution: Slope (m) = 1, Intercept (b) = -1

Example 4:

X values: 0, 1, 2, 3, 4

Y values: 5, 4, 3, 2, 1

Solution: Slope (m) = -1, Intercept (b) = 5

Example 5:

X values: 1, 2, 3, 4, 5

Y values: 3, 5, 7, 9, 11

Solution: Slope (m) = 2, Intercept (b) = 1

Example 6:

X values: 1, 4, 7, 10, 13

Y values: 2, 8, 14, 20, 26

Solution: Slope (m) = 2, Intercept (b) = 0

Example 7:

X values: 2, 5, 8, 11, 14

Y values: 1, 4, 7, 10, 13

Solution: Slope (m) = 1, Intercept (b) = -1

Example 8:

X values: 1, 2, 3, 4, 5

Y values: 1, 2, 1, 2, 1

Solution: Slope (m) = 0, Intercept (b) = 1.5

Example 9:

X values: 1, 3, 5, 7, 9

Y values: 9, 5, 3, 5, 9

Solution: Slope (m) = 0, Intercept (b) = 6.2

Example 10:

X values: 1, 4, 7, 10, 13

Y values: 2, 5, 8, 11, 14

Solution: Slope (m) = 1, Intercept (b) = 1

Example 11:

X values: 1, 2, 3, 4, 5

Y values: 3, 7, 11, 15, 19

Solution: Slope (m) = 4, Intercept (b) = -1

Example 12:

X values: 1, 3, 5, 7, 9

Y values: 1, 3, 5, 7, 9

Solution: Slope (m) = 1, Intercept (b) = 0

Example 13:

X values: 2, 3, 4, 5, 6

Y values: 3, 6, 9, 12, 15

Solution: Slope (m) = 3, Intercept (b) = -3

Example 14:

X values: 0, 1, 2, 3, 4

Y values: 10, 9, 8, 7, 6

Solution: Slope (m) = -1, Intercept (b) = 10

Example 15:

X values: 1, 4, 6, 8, 10

Y values: 2, 5, 7, 9, 12

Solution: Slope (m) = 1.2, Intercept (b) = 0.8

Example 16:

X values: 1, 2, 3, 4, 5

Y values: 2, 2.5, 3, 3.5, 4

Solution: Slope (m) = 0.5, Intercept (b) = 1.5

Example 17:

X values: 1, 2, 3, 4, 5

Y values: 10, 8, 6, 4, 2

Solution: Slope (m) = -2, Intercept (b) = 12

Example 18:

X values: 1, 3, 5, 7, 9

Y values: 3, 6, 7, 8, 11

Solution: Slope (m) = 0.8, Intercept (b) = 2.2

Example 19:

X values: 0, 2, 4, 6, 8

Y values: 5, 7, 9, 11, 13

Solution: Slope (m) = 1, Intercept (b) = 5

Example 20:

X values: 1, 2, 3, 4, 5

Y values: 4, 5, 6, 7, 8

Solution: Slope (m) = 1, Intercept (b) = 3

Published on: 2025-07-05 00:00:00
Author: Taylor Bennett

© 2025 Calculatoric.com All rights reserved

Policy

Rendered in 0.0060 seconds.