Least Squares Regression
Loading the math board and drawing, please wait…
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
OrthogonalLine(A, xAxis) → fOrthogonalLine(C, xAxis) → gOrthogonalLine(E, xAxis) → hOrthogonalLine(B, xAxis) → iOrthogonalLine(D, xAxis) → jOrthogonalLine(G, xAxis) → kOrthogonalLine(F, xAxis) → lOrthogonalLine(H, xAxis) → mOrthogonalLine(I, xAxis) → nLine(J, K) → pIntersect(p, f) → LIntersect(p, g) → MIntersect(p, h) → NIntersect(p, i) → OIntersect(p, j) → PIntersect(p, k) → QIntersect(p, l) → RIntersect(p, m) → SIntersect(p, n) → TPolygon(A, L, 4) → poly1, q, r, s, t, U, VPolygon(C, M, 4) → poly2, a, b, c, d, W, ZPolygon(E, N, 4) → poly3, e, f_1, g_1, h_1, A_1, B_1Polygon(B, O, 4) → poly4, i_1, j_1, k_1, l_1, C_1, D_1Polygon(D, P, 4) → poly5, m_1, n_1, p_1, q_1, E_1, F_1Polygon(G, Q, 4) → poly6, r_1, s_1, t_1, a_1, G_1, H_1Polygon(F, R, 4) → poly7, b_1, c_1, d_1, e_1, I_1, J_1Polygon(H, S, 4) → poly8, f_2, g_2, h_2, i_2, K_1, L_1Polygon(I, T, 4) → poly9, j_2, k_2, l_2, m_2, M_1, N_1FitLineY({A, B, C, D, E, F, G, H, I}) → n_2Intersect(f, n_2) → O_1Intersect(g, n_2) → P_1Intersect(i, n_2) → Q_1Intersect(j, n_2) → R_1Intersect(l, n_2) → S_1Intersect(h, n_2) → T_1Intersect(m, n_2) → U_1Intersect(k, n_2) → V_1Intersect(n, n_2) → W_1Polygon(A, O_1, 4) → poly10, p_2, q_2, r_2, s_2, Z_1, A_2Polygon(P_1, C, 4) → poly11, t_2, a_2, b_2, c_2, B_2, C_2Polygon(B, Q_1, 4) → poly12, d_2, e_2, f_3, g_3, D_2, E_2Polygon(D, R_1, 4) → poly13, h_3, i_3, j_3, k_3, F_2, G_2Polygon(S_1, F, 4) → poly14, l_3, m_3, n_3, p_3, H_2, I_2Polygon(E, T_1, 4) → poly15, q_3, r_3, s_3, t_3, J_2, K_2Polygon(H, U_1, 4) → poly16, a_3, b_3, c_3, d_3, L_2, M_2Polygon(G, V_1, 4) → poly17, e_3, f_4, g_4, h_4, N_2, O_2Polygon(W_1, I, 4) → poly18, i_4, j_4, k_4, l_4, P_2, Q_2PMCC({A, B, C, D, E, F, G, H, I}) → ς