
Andy C. answered 08/19/18
Tutor
4.9
(27)
Math/Physics Tutor
The short answer is:
You use the x-coordinate from each ordered pair
However I have PLENTY of examples I can show you
because I teach this all the time in my classes.
for more info and a quick example, read on.....
===================================================
Basically you set up the 6-column table like this
x y x^2 xy Mx+b Error = y - (mx+b)
Then you find the total of each column.
N is the # of ordered pairs (points) you have in the scatter plot.
You plug the totals into the following formulas:
denominator D = N * (total of X^2) - (total of x)^2
slope M = [N*(total of XY) - (total of X)(total of Y)]/D
intercept B = [ (total of Y)(total of X^2) - (total X)(total of X^2)]/D
Here is an example using simple numbers:
(1,2) , (2,3) , and (3,4) is the sample data.
[clearly the line equation is y = x+1 so that the slope M=1 and intercept B=1.]
X y x^2 xy line estimate=mx+b error = y - line estimate
1 2 1 2 2 0
2 3 4 6 3 0
3 4 9 12 4 0
---------------------------------------------------------------------------------------------------
6 9 14 20 9 0
D = 3*14 - 6^2 = 42 - 36 = 6
M = (3*20 - 6*9)/6 = (60-54)/6 = 6/6=1
B= (9*14 - 6*20)/6 = (126 - 120)/6 = 6/6 =1
So the line equation (as expected) is y = mx + b = 1x+1 = x+1
Each line estimate is found by plugging in the x-coordinate of each ordered pair..
(this is part you were asking about I presume)
So for x=1, y = (1)(1)+1 = 1+1=2
for x=2, y = 1*2+1 = 2+1=3
for x=3, y = 1*3+1 = 3+1 = 4
Since these data points line up exactly (as planned), the line estimates
are EXACTLY the same as y for each row. Therefore, each error is zero
and the totals will agree with total of Y and the total of the errors is zero.
However, in every other "real world" problem and homework, the data points
in the scatter plot will NEVER line up. So the line estimates will always be
different from the corresponding y-value. However the total of the errors
MUST be zero.
That is because the BEst Fit trend line by definition, IS the line that
passes through the scatter plot such that the distances from each point (x,y)
to the line add up to zero.
I teach this all the time and can help you some more.
Benny M.
08/19/18