Linear Regression & Calibration
The best straight line through your data
The best straight line through messy data
Calibration is the backbone of quantitative analysis
Real measurements scatter. Least-squares linear regression finds the one line that sits closest to all the points by minimizing the sum of the squared vertical gaps (the residuals):
The correlation coefficient R² reports how much of the total scatter in y the fitted line explains. An R² of 1.000 means every point falls exactly on the line; good analytical calibrations sit above 0.995. Formally, , but in practice you read it directly from the fit output.
Once the line is established, reading an unknown is algebraically trivial: measure the signal y, then invert the line for x: . In spectrophotometry that is . In the method of standard additions, the sample itself acts as a matrix-matched blank and the calibration line is extrapolated to zero signal — so the unknown concentration equals the magnitude of the x-intercept, .
units = [y] / [x]
ideal blank → b ≈ 0
analytical target: R² > 0.995
invert the fitted line
matrix effects cancelled
grows away from mean x
The scatter of data points around the fitted line is measured by the residual standard deviation (n − 2 because fitting a line uses two degrees of freedom). This feeds the standard errors of the slope and intercept:
where . A wider spread of x values (larger ) gives a more precisely determined slope — another reason calibrations should cover the full range of expected analyte concentrations.
The limit of detection (LOD) is conventionally taken as the concentration giving a signal equal to the blank plus three times the standard deviation of the blank:
Residuals should be plotted after every regression. Random scatter about zero confirms linearity; any systematic curve pattern (a parabolic arch, or sign-alternating runs) indicates the model is wrong and a higher-order fit or a restricted concentration range is needed.
- Forcing through the origin unjustifiably. A true Beer–Lambert calibration should pass through the origin only if the blank is zero. An unconstrained fit checks whether is truly zero; a non-zero intercept signals contamination or an offset blank.
- Extrapolating beyond the calibration range. Linearity is only established where you have data. Concentrations above the highest standard enter a zone of unknown curvature — always bracket samples with standards.
- R² near 1 does not prove linearity. A systematic arch in the residuals can coexist with R² = 0.9990. Always plot and inspect residuals.
- Ignoring the uncertainty in c. The formula gives a point estimate; the true uncertainty in c grows as the unknown signal moves away from the mean of the calibration set.
Calibration fit
Drag any calibration point — the least-squares line, slope, intercept, and R² all update instantly.
Five Beer–Lambert standards gave the following (concentration / M, absorbance) pairs: (0.0, 0.002), (0.2, 0.196), (0.4, 0.401), (0.6, 0.598), (0.8, 0.803). Find the least-squares slope and intercept.
The same five points give and . Calculate R² and comment on the calibration quality.
Read off an unknown
Set the measured absorbance and follow the blue guide lines to the concentration axis.
A calibration of permanganate at 525 nm gives the line where c is in mol L⁻¹. An unknown solution gives . Find its concentration.
Lead is determined by standard additions. Four 10.00 mL aliquots of sample are spiked with 0, 5.0, 10.0 and 15.0 ppb added Pb, and the signals (arbitrary) are 0.233, 0.347, 0.461 and 0.575. The fitted line is . What is the Pb concentration in the original sample?
Worked examples
Bring it all together — try each problem before revealing the solution.
A Beer–Lambert calibration at 254 nm uses a 1.00 cm cell and gives a least-squares slope of . What is the molar absorptivity ?
A calibration line is based on standards and has a residual standard deviation (absorbance units) and slope . The unknown absorbance is measured once (), and (mean of calibrators). Estimate the standard uncertainty in .
After fitting a line to seven caffeine standards, the residuals (observed − predicted absorbance) are: +0.003, −0.002, +0.001, −0.005, +0.006, −0.008, +0.004. R² = 0.9982. Should the analyst be happy with the linear fit?
A fluorescence calibration for quinine sulfate has slope . The blank signal is measured 10 times, giving a standard deviation of . Calculate the LOD and the limit of quantification (LOQ = 10 s_blank / m).
A six-point Beer–Lambert calibration of nitrite at 540 nm gives these results after least-squares fitting:
- Slope:
- Intercept:
- Residual std dev:
- Mean of calibrators:
An unknown absorbs at (single measurement, ). Calculate (i) the concentration , (ii) the standard error , and (iii) report the result with a 95 % CI ().
Check yourself
Five quick questions on least squares, R², and reading calibration lines.
The method of least squares finds the line that minimizes the sum of the squared: