Least Squares Regression

Least Squares Regression
Loading the math board and drawing, please wait…
2019-02-19 19:43
This example demonstrates how to fit a best-fit line through data points using the method of least squares. Key math concepts include linear regression, residual sum of squares, and Pearson's correlation coefficient. GeoGebra commands used are OrthogonalLine, Line, Intersect, Polygon, FitLineY, and PMCC. Suitable for high school and above students learning data fitting and statistical modeling.

GeoGebra Commands & Parameters

  1. OrthogonalLine(A, xAxis) → f
  2. OrthogonalLine(C, xAxis) → g
  3. OrthogonalLine(E, xAxis) → h
  4. OrthogonalLine(B, xAxis) → i
  5. OrthogonalLine(D, xAxis) → j
  6. OrthogonalLine(G, xAxis) → k
  7. OrthogonalLine(F, xAxis) → l
  8. OrthogonalLine(H, xAxis) → m
  9. OrthogonalLine(I, xAxis) → n
  10. Line(J, K) → p
  11. Intersect(p, f) → L
  12. Intersect(p, g) → M
  13. Intersect(p, h) → N
  14. Intersect(p, i) → O
  15. Intersect(p, j) → P
  16. Intersect(p, k) → Q
  17. Intersect(p, l) → R
  18. Intersect(p, m) → S
  19. Intersect(p, n) → T
  20. Polygon(A, L, 4) → poly1, q, r, s, t, U, V
  21. Polygon(C, M, 4) → poly2, a, b, c, d, W, Z
  22. Polygon(E, N, 4) → poly3, e, f_1, g_1, h_1, A_1, B_1
  23. Polygon(B, O, 4) → poly4, i_1, j_1, k_1, l_1, C_1, D_1
  24. Polygon(D, P, 4) → poly5, m_1, n_1, p_1, q_1, E_1, F_1
  25. Polygon(G, Q, 4) → poly6, r_1, s_1, t_1, a_1, G_1, H_1
  26. Polygon(F, R, 4) → poly7, b_1, c_1, d_1, e_1, I_1, J_1
  27. Polygon(H, S, 4) → poly8, f_2, g_2, h_2, i_2, K_1, L_1
  28. Polygon(I, T, 4) → poly9, j_2, k_2, l_2, m_2, M_1, N_1
  29. FitLineY({A, B, C, D, E, F, G, H, I}) → n_2
  30. Intersect(f, n_2) → O_1
  31. Intersect(g, n_2) → P_1
  32. Intersect(i, n_2) → Q_1
  33. Intersect(j, n_2) → R_1
  34. Intersect(l, n_2) → S_1
  35. Intersect(h, n_2) → T_1
  36. Intersect(m, n_2) → U_1
  37. Intersect(k, n_2) → V_1
  38. Intersect(n, n_2) → W_1
  39. Polygon(A, O_1, 4) → poly10, p_2, q_2, r_2, s_2, Z_1, A_2
  40. Polygon(P_1, C, 4) → poly11, t_2, a_2, b_2, c_2, B_2, C_2
  41. Polygon(B, Q_1, 4) → poly12, d_2, e_2, f_3, g_3, D_2, E_2
  42. Polygon(D, R_1, 4) → poly13, h_3, i_3, j_3, k_3, F_2, G_2
  43. Polygon(S_1, F, 4) → poly14, l_3, m_3, n_3, p_3, H_2, I_2
  44. Polygon(E, T_1, 4) → poly15, q_3, r_3, s_3, t_3, J_2, K_2
  45. Polygon(H, U_1, 4) → poly16, a_3, b_3, c_3, d_3, L_2, M_2
  46. Polygon(G, V_1, 4) → poly17, e_3, f_4, g_4, h_4, N_2, O_2
  47. Polygon(W_1, I, 4) → poly18, i_4, j_4, k_4, l_4, P_2, Q_2
  48. PMCC({A, B, C, D, E, F, G, H, I}) → ς