Linear Regression Example 1: Least-Squares Fit Line

Linear Regression Example 1: Least-Squares Fit Line
Loading the math board and drawing, please wait…
2016-11-10 21:58
①This example demonstrates how to fit a best-fit linear regression line to a set of scattered data points, and visualizes the vertical deviations between the data points and the fitted line. ②Core mathematical concepts include linear regression, the method of least squares, the fitted line (FitLineY), and the geometric meaning of residuals (vertical distances). ③Construction highlights: The GeoGebra command FitLineY generates the regression line, while commands such as Line, OrthogonalLine, and Intersect are used to construct perpendiculars and intersection points; Polygon and Sum are used to compute the sum of squared deviations. Objects include points A, B, C, D, E, F, H, multiple auxiliary lines (a, b, c, d, e, f, g, h, i, j, k, l, m, n, p, q, r, s), and several polygons (poly1, poly2, poly3, poly4). ④Suitable for high school or introductory college statistics courses, this example helps students intuitively grasp the geometric principle of least squares and the computation of the regression line.

GeoGebra Commands & Parameters

  1. Line(F, H) → a
  2. OrthogonalLine(A, xAxis) → b
  3. OrthogonalLine(E, xAxis) → c
  4. OrthogonalLine(B, xAxis) → d
  5. OrthogonalLine(D, xAxis) → e
  6. OrthogonalLine(C, xAxis) → f
  7. Intersect(b, a) → H_1
  8. Intersect(c, a) → I
  9. Intersect(d, a) → J
  10. Intersect(a, f) → K
  11. Intersect(e, a) → L
  12. Polygon(A, H_1, 4) → poly1, g, h, i, j, M, N
  13. Polygon(I, E, 4) → poly2, k, l, m, n, O, P
  14. Polygon(B, J, 4) → poly3, p, q, r, s, Q, R
  15. Polygon(L, D, 4) → poly4, t, a_1, b_1, c_1, S, T
  16. Polygon(K, C, 4) → poly5, d_1, e_1, f_1, g_1, U, V
  17. Sum(A1:A5) → A6
  18. FitLineY({A, B, C, D, E}) → h_1