Linear Regression Exploration
Author: John Maharry
Date: 1/9/2007

Click on the worksheet to start. You can move the Blue Data Points around. Then change the slope and intercept of the line to try to minimize the Error.  The error for each point is measured as the square of the distance from the point to the line.

A = (3.466666666666667, 6.833333333333333)
B = (5.6, 4.4)
C = (11.833333333333334, 9.166666666666666)
D = (16.566666666666666, 6.566666666666666)
E = (21.966666666666665, 9.233333333333333)
m = 0.16000000000000014 (slider from -2 to 2, step 0.02)
b = 4.700000000000001 (slider from -5 to 12, step 0.1)
f(x) = m x + b
A1: (x(A), m x(A) + b)
a = Segment(A, A1)
B1: (x(B), m x(B) + b)
c = Segment(B, B1)
C1: (x(C), m x(C) + b)
d = Segment(C, C1)
D1: (x(D), m x(D) + b)
e = Segment(D, D1)
E1: (x(E), m x(E) + b)
g = Segment(E, E1)
Error: Distance[A, A1] + Distance[B, B1] + Distance[C, C1] + Distance[D, D1] + Distance[E, E1]
SquareError: Distance[A, A1]² + Distance[B, B1]² + Distance[C, C1]² + Distance[D, D1]² + Distance[E, E1]²
T2: "Error A  =  " + (Distance[A, A1]²) + "
Error B  =  " + (Distance[B, B1]²) + "
Error C =  " + (Distance[C, C1]²) + "
Error D  =  " + (Distance[D, D1]²) + "
Error E  =  " + (Distance[E, E1]²) + "
Total Square Error  = " + SquareError