Find the equation of the line of best fit for the points (-4,10) (-1,5)(2,-1)(3,-6)(5,-7)
3 answers
https://dataprivacylab.org/courses/popd/lab2/ExcelLine.pdf
Recall how to do the math. Let x̅ and y̅ be the means for x and y.
Then the slope of the best-fit line is
m = ∑(x-x̅)(y-y̅) / ∑(x-x̅)^2
So, for your data that means
x̅ = (-4 + -1 + 2 + 3 + 5)/5 = 1
y̅ = (10 + 5 + -1 + -6 + -7)/5 = 0.2
m = ((-4-1)(10-.2)+(-1-1)(5-.2)+(2-1)(-1-.2)+(3-1)(-6-.2)+(5-1)(-7-.2))/((-4-1)^2+(-1-1)^2+(2-1)^2+(3-1)^2+(5-1)^2) = -2.02
So, the line is
y = mx+b where b=y̅-mx̅
y = -2.02x-1.82
Then the slope of the best-fit line is
m = ∑(x-x̅)(y-y̅) / ∑(x-x̅)^2
So, for your data that means
x̅ = (-4 + -1 + 2 + 3 + 5)/5 = 1
y̅ = (10 + 5 + -1 + -6 + -7)/5 = 0.2
m = ((-4-1)(10-.2)+(-1-1)(5-.2)+(2-1)(-1-.2)+(3-1)(-6-.2)+(5-1)(-7-.2))/((-4-1)^2+(-1-1)^2+(2-1)^2+(3-1)^2+(5-1)^2) = -2.02
So, the line is
y = mx+b where b=y̅-mx̅
y = -2.02x-1.82
y= -2x + 2
i just did this and i got it right :)
i just did this and i got it right :)