Chapter 3 of 5

The OLS Solution

Hand calculation, step by step

OLS finds the one line with the smallest sum of squared error. Let's calculate it by hand.

4681012Annual Salary (M€)010203040Market Value (M€)Some guess

Step 1: Find the averages. (mean salary) and (mean value).

4681012Annual Salary (M€)010203040Market Value (M€)
x̄ (mean salary) 0.0 M€
ȳ (mean market value) 0.0 M€

Step 2: How far is each point from the average? These are deviations.

4681012Annual Salary (M€)010203040Market Value (M€)

Step 3: Multiply the deviations together. Sum them up, then divide by n − 1 — that's the covariance.

Cov(x,y)=i=1n(xixˉ)(yiyˉ)n1\text{Cov}(x, y) = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{n - 1}
#xi - x̄×yi - ȳ=product
1-4.21×-13.6=57.2
2-3.21×-11.6=37.2
3-2.61×-3.6=9.4
4-1.56×-9.6=15.0
5-1.14×-1.6=1.8
6-0.41×3.4=-1.4
7-0.01×0.4=-0.0
80.19×-6.6=-1.3
90.49×0.4=0.2
100.99×-1.6=-1.6
111.39×5.4=7.5
121.69×8.4=14.2
132.29×6.4=14.7
142.69×13.4=36.1
153.39×10.4=35.3
Sum / (n - 1) =16.0
Cov(x, y) 0.0

Step 4: Square the x-deviations and average them. That's the variance of x.

Var(x)=i=1n(xixˉ)2n1\text{Var}(x) = \frac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n - 1}
#xi - x̄(xi - x̄)²
1-4.2117.71
2-3.2110.29
3-2.616.80
4-1.562.43
5-1.141.30
6-0.410.17
7-0.010.00
80.190.04
90.490.24
100.990.98
111.391.94
121.692.86
132.295.25
142.697.25
153.3911.51
Sum / (n - 1) =4.9
Var(x) 0.0

Step 5: Divide covariance by variance. That's β₁, the slope.

β1=Cov(x,y)Var(x)\beta_1 = \frac{\text{Cov}(x, y)}{\text{Var}(x)}
Cov(x,y) 16.0
/
Var(x) 4.9
=
β₁ (slope) 0.00

For every additional €1M in annual salary, the predicted market value increases by €3.3M.


Step 6: Calculating the intercept. β₀ = ȳ − β₁ · x̄

β0=yˉβ1xˉ\beta_0 = \bar{y} - \beta_1 \cdot \bar{x}
ȳ (mean market value) 31.6 from Step 1
β₁ (slope) 3.26 from Step 5
×
x̄ (mean salary) 7.8 from Step 1
=
β₀ (intercept) 0.0 M€

A player with €0M salary would have a predicted market value of €6.1M. (It's the baseline, not a real prediction.)

The intuition behind this formula is: we need to select an intercept, so that when we plug in the mean value of X in the model, we would get the mean value of Y.

© 2026 Mohammad Iman