Chem Math· Math-for-Chemists Hub
Atlas Chapter 11: Probability & Statistics Interactive lesson

Linear Regression & Calibration

The best straight line through your data

Analytical
Detail level

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, .

Slope

units = [y] / [x]
Intercept

ideal blank → b ≈ 0
R² — goodness of fit

analytical target: R² > 0.995
Read off an unknown

invert the fitted line
Standard additions x-intercept

matrix effects cancelled
Uncertainty in c

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.

Common pitfalls
  • 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.
The analytical workflow
Run standards of known concentration, plot signal vs concentration, fit a line, then read unknowns off it. It's how UV–Vis (Beer–Lambert), AAS, ICP, chromatography and electrochemistry all turn a raw signal into a number. Open the Calibration fit and drag the points.

Calibration fit

Drag any calibration point — the least-squares line, slope, intercept, and R² all update instantly.

Drag any point up or down — the least-squares line and R² update live
00.200.400.600.80100.200.400.600.801concentration / Mabsorbance
slope m0.821
intercept b0.044
0.9987
The green dashes are the residuals the fit is squaring and minimizing. Drag one point into an outlier and watch R² fall — analytical chemists usually want R² > 0.995 before trusting a calibration.
Worked example 1Calculating slope and intercept by hand

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.

Worked example 2R² and what it tells you

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.

Set the unknown's absorbance and read its concentration off the line
00.200.400.600.80100.200.400.600.801concentration / Mabsorbance
unknown absorbance A0.50
fit slope m0.821
fit intercept b0.044
unknown concentration0.555 M
This is the everyday job of a calibration curve: measure an unknown's signal, drop down to the line, and read the concentration. The blue track shows A → line → c.
Worked example 3Reading a concentration from a Beer–Lambert calibration

A calibration of permanganate at 525 nm gives the line where c is in mol L⁻¹. An unknown solution gives . Find its concentration.

Worked example 4Method of standard additions — finding the unknown from the x-intercept

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.

Worked example 5Molar absorptivity from the slope

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 ?

Worked example 6Uncertainty in the calibrated concentration

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 .

Worked example 7Is the calibration linear? Interpreting a residual plot

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?

Worked example 8Limit of detection from a calibration blank

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).

ChallengeChallenge — concentration of an unknown with uncertainty from a calibration

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.

Question 1 of 5 · Score 0

The method of least squares finds the line that minimizes the sum of the squared:

Choose an answer.