Assignment: Linear Regression & Uncertainty (Manual Working)
Question. Using the data of current I (mA) and voltage V (V) across a fixed resistor, determine
the least-squares line V = mI + c and the uncertainties u(m) and u(c).
Given data:
i Current I (mA) Voltage V (V)
1 3.2 1.5
2 5.6 3.0
3 8.1 4.5
4 12.9 6.0
5 18.9 9.0
6 26.7 13.5
Step 1 – Compute the basic sums (showing the arithmetic).
Σx = 3.2 + 5.6 + 8.1 + 12.9 + 18.9 + 26.7 = 75.4 mA
Σy = 1.5 + 3.0 + 4.5 + 6.0 + 9.0 + 13.5 = 37.5 V
Σx² = 3.2² + 5.6² + 8.1² + 12.9² + 18.9² + 26.7² = 1343.72 (mA)²
Σ(xy) = (3.2)(1.5) + (5.6)(3.0) + (8.1)(4.5) + (12.9)(6.0) + (18.9)(9.0) + (26.7)(13.5) = 666.00 V·mA
Step 2 – Means:
x̄ = Σx/n = 75.4/6 = 12.5667 mA
ȳ = Σy/n = 37.5/6 = 6.2500 V
Step 3 – Centered sums:
Sxx = Σx² − n·x̄ ² = 1343.72 − 6×(12.5667)² = 396.193 (mA)²
Sxy = Σ(xy) − n·x̄ ·ȳ = 666.00 − 6×(12.5667)×(6.2500) = 194.750 V·mA
Step 4 – Least-squares slope and intercept:
m = Sxy / Sxx = 194.750 / 396.193 = 0.491553 V/mA
c = ȳ − m x̄ = 6.2500 − (0.491553)×(12.5667) = 0.072818 V
Step 5 – Residuals (to estimate scatter): d_i = y_i − (m x_i + c).
i x_i (mA) y_i (V) ŷ_i = m x_i + c d_i = y_i − ŷ_i
(V) (V)
1 3.2 1.5 1.6458 -0.1458
2 5.6 3.0 2.8255 0.1745
3 8.1 4.5 4.0544 0.4456
4 12.9 6.0 6.4139 -0.4139
5 18.9 9.0 9.3632 -0.3632
6 26.7 13.5 13.1973 0.3027
Σ d_i² = 0.645064 V²
Step 6 – Uncertainties (standard errors):
u(m) = sqrt{ [Σ d_i² / Sxx] × [1/(n − 2)] } = sqrt{ [0.645064 / 396.193] × [1/4] } = 0.020175 V/mA
u(c) = sqrt{ [Σ d_i² × Σx² / (n Sxx)] × [1/(n − 2)] } = 0.301923 V
Final reported values (3 s.f.):
m ± u(m) = (0.492 ± 0.020) V/mA
c ± u(c) = (0.073 ± 0.302) V
Since 1 V per mA equals 1 kΩ, the resistor value is R = m kΩ ≈ (492 ± 20) Ω.