Regression, Abstandsquadratsumme f(m,k)
Author: Prof. Dr. Dörte Haftendorn
Date: 2009/2013

Bewege m und k mit den Pfeitasten.

Parabel für A

Parabel für B

A

B

S

Ha 2009/13

Lösung

P5 = (14, 6)
m = 0.24 (slider from -1 to 2, step 0.001)
P4 = (11, 3)
P3 = (6, 2)
P2 = (3, 3)
P1 = (1, 1)
k = 1.58 (slider from -2 to 5, step 0.01)
g(x) = m * x + k
xquer: (x(P1) + x(P2) + x(P3) + x(P4) + x(P5)) / 5
yquer: (y(P1) + y(P2) + y(P3) + y(P4) + y(P5)) / 5
S: (xquer, yquer)
fmk: (y(P1) - m * x(P1) - k)^(2) + (y(P2) - m * x(P2) - k)^(2) + (y(P3) - m * x(P3) - k)^(2) + (y(P4) - m * x(P4) - k)^(2) + (y(P5) - m * x(P5) - k)^(2)
b: 1 * y = (y(P1) - 1 * x * x(P1) - k)^(2) + (y(P2) - 1 * x * x(P2) - k)^(2) + (y(P3) - 1 * x * x(P3) - k)^(2) + (y(P4) - 1 * x * x(P4) - k)^(2) + (y(P5) - 1 * x * x(P5) - k)^(2)
a: 1 * y = (y(P1) - m * x(P1) - 1 * x)^(2) + (y(P2) - m * x(P2) - 1 * x)^(2) + (y(P3) - m * x(P3) - 1 * x)^(2) + (y(P4) - m * x(P4) - 1 * x)^(2) + (y(P5) - m * x(P5) - 1 * x)^(2)
A = Vertex(a)
B = Vertex(b)
R1: (x(P1), g(x(P1)))
R2: (x(P2), g(x(P2)))
R3: (x(P3), g(x(P3)))
R4: (x(P4), g(x(P4)))
r1 = Segment(R1, P1)
r2 = Segment(R2, P2)
r3 = Segment(R3, P3)
r4 = Segment(R4, P4)
P, p1, c, r1 + (r1, 0), p1 + (r1, 0), d = Polygon(P1, R1, R1 + (r1, 0), P1 + (r1, 0), P1)
Q, p2, e, r2 + (r2, 0), p2 + (r2, 0), f = Polygon(P2, R2, R2 + (r2, 0), P2 + (r2, 0), P2)
R, p3, h, r3 + (r3, 0), p3 + (r3, 0), i = Polygon(P3, R3, R3 + (r3, 0), P3 + (r3, 0), P3)
T, p4, j, r4 + (r4, 0), p4 + (r4, 0), l = Polygon(P4, R4, R4 + (r4, 0), P4 + (r4, 0), P4)
C = Point(xAxis)
U, n, c + (1, 0), c + (1, fmk), c + (0, fmk) = Polygon(C, C + (1, 0), C + (1, fmk), C + (0, fmk))
R5: (x(P5), g(x(P5)))
Vieleck1, p5, r5, r, s, D, E = Polygon(P5, R5, 4)
o = true
p = true
q = true
t = true
u = true
Text1: "f(m,k) =" + fmk + ""
Text2: "S= " + S + ""
rg = FitLineY({P1, P2, P3, P4, P5})
Text4: "Gerechnete Regressionsgerade   " + rg + ""
v = false