Correlation and the Line of Best Fit

Correlation and the Line of Best Fit
Loading the math board and drawing, please wait…
2020-03-22 18:45
This example demonstrates how to visualize data correlation through scatter plots and draw the line of best fit. Core math concepts include Pearson's correlation coefficient (PMCC), mean, standard deviation, and linear regression. GeoGebra commands and objects used are If, Sequence, MeanY, SampleSDY, MeanX, PMCC, SampleSDX, SampleSDY, Sum, TableText, Textfield, Mirror, Max, mean, SDX, SDY. Suitable for high school mathematics teaching, focusing on data analysis and statistical modeling.

GeoGebra Commands & Parameters

  1. If(xvalues ≥ 1, Element[list1, 1], 0) → G4
  2. If(xvalues ≥ 2, Element[list1, 2], 0) → G5
  3. If(xvalues ≥ 3, Element[list1, 3], 0) → G6
  4. If(xvalues ≥ 4, Element[list1, 4], 0) → G7
  5. If(xvalues ≥ 5, Element[list1, 5], 0) → G8
  6. If(xvalues ≥ 8, Element[list1, 8], 0) → G11
  7. If(xvalues ≥ 9, Element[list1, 9], 0) → G12
  8. If(xvalues ≥ 10, Element[list1, 10], 0) → G13
  9. If(xvalues ≥ 11, Element[list1, 11], 0) → G14
  10. If(xvalues ≥ 6, Element[list1, 6], 0) → G9
  11. If(xvalues ≥ 7, Element[list1, 7], 0) → G10
  12. If(xvalues ≥ 15, Element[list1, 15], 0) → G18
  13. If(xvalues ≥ 12, Element[list1, 12], 0) → G15
  14. If(xvalues ≥ 13, Element[list1, 13], 0) → G16
  15. If(xvalues ≥ 14, Element[list1, 14], 0) → G17
  16. If(xvalues ≥ 16, Element[list1, 16], 0) → G19
  17. If(xvalues ≥ 17, Element[list1, 17], 0) → G20
  18. If(xvalues ≥ 18, Element[list1, 18], 0) → G21
  19. If(xvalues ≥ 19, Element[list1, 19], 0) → G22
  20. If(xvalues ≥ 20, Element[list1, 20], 0) → G23
  21. If(xvalues ≥ 1, Element[list2, 1], 0) → H4
  22. If(xvalues ≥ 2, Element[list2, 2], 0) → H5
  23. If(xvalues ≥ 3, Element[list2, 3], 0) → H6
  24. If(xvalues ≥ 4, Element[list2, 4], 0) → H7
  25. If(xvalues ≥ 6, Element[list2, 6], 0) → H9
  26. If(xvalues ≥ 7, Element[list2, 7], 0) → H10
  27. If(xvalues ≥ 8, Element[list2, 8], 0) → H11
  28. If(xvalues ≥ 9, Element[list2, 9], 0) → H12
  29. If(xvalues ≥ 10, Element[list2, 10], 0) → H13
  30. If(xvalues ≥ 11, Element[list2, 11], 0) → H14
  31. If(xvalues ≥ 12, Element[list2, 12], 0) → H15
  32. If(xvalues ≥ 13, Element[list2, 13], 0) → H16
  33. If(xvalues ≥ 14, Element[list2, 14], 0) → H17
  34. If(xvalues ≥ 15, Element[list2, 15], 0) → H18
  35. If(xvalues ≥ 16, Element[list2, 16], 0) → H19
  36. If(xvalues ≥ 17, Element[list2, 17], 0) → H20
  37. If(xvalues ≥ 18, Element[list2, 18], 0) → H21
  38. If(xvalues ≥ 19, Element[list2, 19], 0) → H22
  39. If(xvalues ≥ 20, Element[list2, 20], 0) → H23
  40. If(xvalues ≥ 5, Element[list2, 5], 0) → H8
  41. Sequence(Element[list2, j], j, 1, xvalues) → list4
  42. MeanY(list5) → meany
  43. Sequence(Element[list1, i], i, 1, xvalues) → list3
  44. SampleSDY(list5) → Sy
  45. MeanX(list5) → meanx
  46. PMCC(list3, list4) → r
  47. SampleSDX(list5) → Sx
  48. Sum(F4:F23) → F25
  49. If(s1, meanx + "", "\lightgreen{Δ}") → J28
  50. If(s2, meany + "", "\lightgreen{Δ}") → J29
  51. If(s3, SampleSDX[list5] + "", "\lightgreen{Δ}") → J30
  52. If(s4, SampleSDY[list5] + "", "\lightgreen{Δ}") → J31
  53. If(s5, r + "", "\lightgreen{Δ}") → J32
  54. If(s7, m + "", "\lightgreen{Δ}") → J33
  55. If(s6, intercept + "", "\lightgreen{Δ}") → J34
  56. TableText({{I28, J28}, {I29, J29}, {I30, J30}, {I31, J31}, {I32, J32}, {I33, J33}, {I34, J34}}, "|_") → text5
  57. If(xvalues ≥ 6, Element[list1, 6], 0) → text6
  58. If(xvalues ≥ 6, Element[list1, 6], 0) → ""
  59. If(xvalues ≥ 4, Element[list2, 4], 0) → text8
  60. Textfield(o) → InputBox1
  61. Mirror(f, h) → f'
  62. Textfield(aa) → InputBox2
  63. Max(list1) → xmax
  64. Max(list2) → ymax
  65. mean(B4:B23) → F28
  66. mean(C4:C23) → G28
  67. SDX(list5) → F29
  68. SDY(list5) → G29
  69. mean(B4:B23) → B26