Let us apply the least-squares formulae to a small set of data.

Example

Given the points (1;2)(1;\,2), (2;3,5)(2;\,3{,}5), (3;4)(3;\,4), (4;5,5)(4;\,5{,}5), (5;6)(5;\,6): xˉ=3,  yˉ=4,2,  xiyi=66,5,  xi2=55.\bar{x}=3,\;\bar{y}=4{,}2,\; \sum x_iy_i = 66{,}5,\; \sum x_i^2 = 55. m=566,51521555225=332,5315275225=17,550=0,95,q=4,20,953=1,35.m = \frac{5\cdot 66{,}5 - 15\cdot 21}{5\cdot 55 - 225} = \frac{332{,}5-315}{275-225} = \frac{17{,}5}{50} = \boxed{0{,}95},\qquad q = 4{,}2-0{,}95\cdot 3 = \boxed{1{,}35}. Line: y=0,95x+1,35y = 0{,}95\,x+1{,}35.

The graph shows the data (in red), the regression line (in blue) and the centroid (xˉ,yˉ)=(3;4,2)(\bar{x},\bar{y})=(3;\,4{,}2) through which the line passes (in green).

The five experimental points, the least-squares line and the centroid of the data.

Topics: Radicals
Concepts: Least squares · Linear regression
Skills: Calculating · Interpreting a graph · Plotting a graph