Data Interpretation, Error Analysis and Least-Squares Fitting
CSIR NET experimental methods: accuracy and precision, error types, standard error, Poisson counting, error propagation, least squares and chi-square.
- 17 min
On this page · 13 sections
Prerequisites
- Mean, variance and the normal distribution, from Histograms, Distributions, Scatter and Box Plots.
- Partial derivatives and Taylor expansion to first order, from Dimensional Analysis and Vector Calculus.
- Reading straight-line and log plots, from Graphs of Functions and Scientific Plots.
The Hook: Two Students, One Pendulum
Accuracy, Precision and the Kinds of Error
| Term | Meaning |
|---|---|
| Accuracy | closeness of the result to the true value |
| Precision | closeness of repeated results to each other (reproducibility) |
| Resolution / least count | smallest change the instrument can display |
| Sensitivity | output change per unit input change |
| Absolute error | \( \Delta x \), in the units of \( x \) |
| Relative (fractional) error | \( \Delta x/x \); percentage error \( = 100\Delta x/x \) |
A precise result can be inaccurate (a tightly clustered set of readings all shifted by a zero error); an accurate mean can come from imprecise readings.
| Error type | Origin | Behaviour | Remedy |
|---|---|---|---|
| Systematic | miscalibration, zero error, parallax, method or theory (neglected friction, finite-size effects), environment | same sign and size each time; not reduced by averaging | calibrate, change method, apply corrections |
| Random | uncontrolled fluctuations, reading estimation, noise | scatter both ways; averages out | repeat and average; error of mean \( \propto 1/\sqrt N \) |
| Gross (blunder) | misreading, recording mistakes | isolated wild values | check, repeat, reject with justification |
Significant figures. Quote the uncertainty to one significant figure (two if it begins with 1), and the result to the same decimal place: 9.81 ± 0.04, not 9.8107 ± 0.0438. In multiplication and division, the result has as many significant figures as the least precise factor; in addition and subtraction, as many decimal places as the least precise term.
Describing Repeated Measurements
For \( N \) readings \( x_i \):
$$\bar x = \frac{1}{N}\sum x_i, \qquad \boxed{s = \sqrt{\frac{1}{N - 1}\sum(x_i - \bar x)^2}}, \qquad \boxed{\sigma_{\bar x} = \frac{s}{\sqrt N}}$$- \( s \) (sample standard deviation, with \( N - 1 \) because one degree of freedom was used to find \( \bar x \)) describes the spread of single readings. It does not shrink with more data.
- \( \sigma_{\bar x} \) (standard error of the mean) describes the uncertainty of the mean. It falls as \( 1/\sqrt N \): four times as many readings halve it.
The Gaussian distribution
Random errors from many small independent causes give a normal distribution
$$P(x) = \frac{1}{\sigma\sqrt{2\pi}}\exp\left[-\frac{(x - \mu)^2}{2\sigma^2}\right]$$| Interval | Probability |
|---|---|
| \( \mu \pm \sigma \) | 68.3% |
| \( \mu \pm 2\sigma \) | 95.4% |
| \( \mu \pm 3\sigma \) | 99.7% |
| FWHM | \( 2\sqrt{2\ln2}\,\sigma = 2.355\sigma \) |
Comparing two results: \( A \pm \sigma_A \) and \( B \pm \sigma_B \) (independent) disagree significantly if \( \lvert A - B\rvert \) exceeds about \( 2\sqrt{\sigma_A^2 + \sigma_B^2} \).
Counting statistics (Poisson)
When counting independent random events (radioactive decays, photons), the number recorded in a fixed time follows a Poisson distribution, for which variance equals mean:
$$\boxed{\sigma_N = \sqrt N}, \qquad \frac{\sigma_N}{N} = \frac{1}{\sqrt N}$$So 1% precision needs \( 10^4 \) counts. For a rate \( R = N/t \), \( \sigma_R = \sqrt N/t \). For a net signal after background subtraction, the variances add:
$$R_{net} = \frac{N_s}{t_s} - \frac{N_b}{t_b}, \qquad \sigma_{net} = \sqrt{\frac{N_s}{t_s^2} + \frac{N_b}{t_b^2}}$$The Poisson distribution approaches a Gaussian for large mean (roughly \( N \gtrsim 20 \)). The same \( \sqrt N \) logic explains signal averaging: averaging \( N \) sweeps of a repetitive signal improves the signal-to-noise ratio by \( \sqrt N \) when the noise is random and uncorrelated.
Propagation of Errors
For \( f(x, y, \ldots) \) with independent errors, expand to first order and add variances:
$$\boxed{\sigma_f^2 = \left(\frac{\partial f}{\partial x}\right)^2\sigma_x^2 + \left(\frac{\partial f}{\partial y}\right)^2\sigma_y^2 + \cdots}$$If \( x \) and \( y \) are correlated, add \( 2\dfrac{\partial f}{\partial x}\dfrac{\partial f}{\partial y}\sigma_{xy} \).
| Function | Rule |
|---|---|
| \( f = x \pm y \) | \( \sigma_f = \sqrt{\sigma_x^2 + \sigma_y^2} \) (absolute errors in quadrature) |
| \( f = xy \) or \( x/y \) | \( \dfrac{\sigma_f}{f} = \sqrt{\left(\dfrac{\sigma_x}{x}\right)^2 + \left(\dfrac{\sigma_y}{y}\right)^2} \) (relative errors in quadrature) |
| \( f = x^n \) | \( \dfrac{\sigma_f}{f} = \lvert n\rvert\dfrac{\sigma_x}{x} \) |
| \( f = cx \) | \( \sigma_f = \lvert c\rvert\sigma_x \) |
| \( f = \ln x \) | \( \sigma_f = \sigma_x/x \) |
| \( f = e^x \) | \( \sigma_f/f = \sigma_x \) |
Many textbooks also teach the maximum (linear) error, which adds absolute values instead of squares: \( \Delta f/f = \Delta x/x + \Delta y/y \). It is an upper bound appropriate when errors may conspire; quadrature is the statistically expected value for independent random errors. Read which the question wants.
Two warnings that the rules make obvious:
- Differences of nearly equal numbers lose relative precision: \( (10.0 \pm 0.3) - (9.6 \pm 0.4) = 0.4 \pm 0.5 \), consistent with zero.
- High powers amplify: in \( g = 4\pi^2L/T^2 \) the period’s relative error counts twice.
Weighted mean
To combine results \( x_i \pm \sigma_i \) of unequal precision, weight each by \( w_i = 1/\sigma_i^2 \):
$$\boxed{\bar x_w = \frac{\sum w_ix_i}{\sum w_i}, \qquad \sigma_{\bar x_w} = \frac{1}{\sqrt{\sum w_i}}}$$The combined uncertainty is always smaller than the smallest individual one.
Least-Squares Fitting
The straight line
Given \( N \) points \( (x_i, y_i) \) with equal uncertainty in \( y \) only, choose \( m \) and \( c \) in \( y = mx + c \) to minimise
$$S = \sum_{i=1}^{N}(y_i - mx_i - c)^2$$Setting \( \partial S/\partial m = \partial S/\partial c = 0 \) gives the normal equations, whose solution is
$$\boxed{m = \frac{N\sum x_iy_i - \sum x_i\sum y_i}{\Delta}, \qquad c = \frac{\sum x_i^2\sum y_i - \sum x_i\sum x_iy_i}{\Delta}, \qquad \Delta = N\sum x_i^2 - \left(\sum x_i\right)^2}$$Equivalently \( c = \bar y - m\bar x \): the best line passes through the centroid \( (\bar x, \bar y) \).
Uncertainties, with the scatter estimated from the residuals:
$$\sigma_y^2 = \frac{1}{N - 2}\sum(y_i - mx_i - c)^2, \qquad \sigma_m = \sigma_y\sqrt{\frac{N}{\Delta}}, \qquad \sigma_c = \sigma_y\sqrt{\frac{\sum x_i^2}{\Delta}}$$\( N - 2 \) because two parameters were fitted. The correlation coefficient
$$r = \frac{\sum(x_i - \bar x)(y_i - \bar y)}{\sqrt{\sum(x_i - \bar x)^2\sum(y_i - \bar y)^2}}$$measures linear association, \( -1 \leq r \leq 1 \). A value near 1 does not prove the model is right: a smooth curve can give \( r = 0.99 \). Look at the residuals: they should scatter randomly about zero, with no trend.
Line through the origin (when theory demands \( c = 0 \)): \( m = \sum x_iy_i/\sum x_i^2 \). Forcing the origin when the data have a real intercept biases the slope.
Linearising
| Model | Plot | Slope | Intercept |
|---|---|---|---|
| \( y = ae^{bx} \) | \( \ln y \) vs \( x \) | \( b \) | \( \ln a \) |
| \( y = ax^n \) | \( \ln y \) vs \( \ln x \) | \( n \) | \( \ln a \) |
| \( T = 2\pi\sqrt{L/g} \) | \( T^2 \) vs \( L \) | \( 4\pi^2/g \) | 0 |
| \( N = N_0e^{-\lambda t} \) | \( \ln N \) vs \( t \) | \( -\lambda \) | \( \ln N_0 \) |
| Diode \( I = I_se^{V/\eta V_T} \) | \( \ln I \) vs \( V \) | \( 1/\eta V_T \) | \( \ln I_s \) |
| Arrhenius \( k = Ae^{-E_a/RT} \) | \( \ln k \) vs \( 1/T \) | \( -E_a/R \) | \( \ln A \) |
Transforming changes the error bars: if \( \sigma_y \) is constant, \( \sigma_{\ln y} = \sigma_y/y \) is not. For Poisson counts, \( \sigma_{\ln N} = 1/\sqrt N \), so a fit of \( \ln N \) should weight each point by \( N \).
Weighted fits and chi-square
When points have different uncertainties \( \sigma_i \), minimise
$$\boxed{\chi^2 = \sum_{i=1}^{N}\frac{\left[y_i - f(x_i; a_1, \ldots, a_p)\right]^2}{\sigma_i^2}}$$The number of degrees of freedom is \( \nu = N - p \). For a correct model with correct error bars, \( \chi^2 \approx \nu \), so the reduced chi-square \( \chi^2_\nu = \chi^2/\nu \approx 1 \).
| \( \chi^2_\nu \) | Interpretation |
|---|---|
| \( \approx 1 \) | model consistent with data, errors realistic |
| \( \gg 1 \) | model wrong, or error bars underestimated |
| \( \ll 1 \) | error bars overestimated (or data suspiciously smooth) |
graph TD
A[Raw data with error bars] --> B{Model linear in parameters?}
B -->|no| C[Linearise: log, reciprocal, square]
C --> D[Transform error bars too]
B -->|yes| E[Least squares: weights 1 over sigma squared]
D --> E
E --> F[Parameters with uncertainties]
F --> G[Residuals and reduced chi-square]
G -->|about 1, random residuals| H[Report result]
G -->|far from 1 or trend| I[Revisit model or error estimates]Memory Tricks
Don’t Confuse
| This | With this | The difference |
|---|---|---|
| Accuracy | Precision | nearness to truth; nearness of repeats to each other |
| Standard deviation \( s \) | Standard error \( s/\sqrt N \) | spread of single readings; uncertainty of the mean |
| Systematic error | Random error | same each time, not reduced by averaging; scatters, reduced by averaging |
| Quadrature addition | Maximum (linear) error | expected error for independent errors; worst-case bound |
| \( r \approx 1 \) | Good model | strong linear association; correct functional form (check residuals) |
| \( \chi^2 \) | \( \chi^2_\nu \) | sum of squared normalised residuals; divided by degrees of freedom |
| \( N - 1 \) | \( N - 2 \) | one parameter (mean) estimated; two (slope and intercept) |
Common Mistakes
Practice
All questions below are original practice questions written for this page. They are not from any CSIR NET paper. Errors are independent and combined in quadrature unless stated.
Level 1: Foundation
- Which kind of error is reduced by averaging many readings?
- A length is measured with 1% relative error. What is the relative error in its cube?
- How many counts are needed for a 1% statistical uncertainty?
Answers
- Random error. Systematic error is unchanged.
- 3%. \( \sigma_f/f = 3\sigma_x/x \).
- \( 10^4 \). \( 1/\sqrt N = 0.01 \).
Level 2: Part B Style
Practice Q1. Five readings of a period are 2.04, 2.00, 1.98, 2.02 and 2.01 s. The mean and its standard error are:
(a) 2.01 ± 0.022 s (b) 2.01 ± 0.010 s (c) 2.01 ± 0.020 s (d) 2.01 ± 0.004 s
Answer: (b) 2.01 ± 0.010 s
Mean 2.010. Deviations: 0.03, −0.01, −0.03, 0.01, 0.00; sum of squares 0.0020. \( s = \sqrt{0.0020/4} = 0.0224 \). Standard error \( 0.0224/\sqrt5 = 0.010 \) s. (a) quotes \( s \); (c) is the spread computed with \( N \) instead of \( N - 1 \), still a spread and not an error of the mean; (d) divides by \( N \) instead of \( \sqrt N \).
Practice Q2. A pendulum gives \( L = 1.000 \pm 0.002 \) m and \( T = 2.006 \pm 0.004 \) s. The value of \( g = 4\pi^2L/T^2 \) is:
(a) 9.81 ± 0.02 m/s\( ^2 \) (b) 9.81 ± 0.04 m/s\( ^2 \) (c) 9.81 ± 0.06 m/s\( ^2 \) (d) 9.8 ± 0.4 m/s\( ^2 \)
Answer: (b) 9.81 ± 0.04 m/s²
\( g = 9.811 \); relative error \( \sqrt{0.0020^2 + (2 \times 0.0020)^2} = 0.0045 \); \( \sigma_g = 0.044 \). (a) keeps only the length error (0.2% of 9.81); forgetting the factor 2 on \( T \) would give \( \pm0.03 \); (c) is the maximum-error (linear) estimate, \( 0.6\% \).
Practice Q3. A detector records 400 counts in 100 s with a source present and 100 counts in 100 s without it. The net count rate is:
(a) \( 3.0 \pm 0.17 \) s\( ^{-1} \) (b) \( 3.0 \pm 0.22 \) s\( ^{-1} \) (c) \( 3.0 \pm 0.30 \) s\( ^{-1} \) (d) \( 3.0 \pm 0.10 \) s\( ^{-1} \)
Answer: (b) 3.0 ± 0.22 s⁻¹
Net rate \( (400 - 100)/100 = 3.0 \) s\( ^{-1} \). \( \sigma = \sqrt{400 + 100}/100 = 0.224 \) s\( ^{-1} \). (a) uses \( \sqrt{300} \), treating the net count as Poisson; (c) adds \( \sqrt{400} + \sqrt{100} \) linearly.
Practice Q4. Two laboratories report \( g = 9.80 \pm 0.02 \) and \( 9.84 \pm 0.04 \) m/s\( ^2 \). Their weighted mean is:
(a) \( 9.820 \pm 0.022 \) (b) \( 9.808 \pm 0.018 \) (c) \( 9.808 \pm 0.030 \) (d) \( 9.820 \pm 0.018 \)
Answer: (b) 9.808 ± 0.018
Weights \( 1/0.02^2 = 2500 \), \( 1/0.04^2 = 625 \). Mean \( = (2500 \times 9.80 + 625 \times 9.84)/3125 = 9.808 \). Error \( 1/\sqrt{3125} = 0.018 \). (a) and (d) use the unweighted mean.
Level 3: Part C Style
Practice Q5. A straight line \( y = mx + c \) is fitted by unweighted least squares to:
| \( x \) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| \( y \) | 2.9 | 5.1 | 7.0 | 9.1 | 10.9 |
Consider:
- \( m = 2.00 \) and \( c = 1.00 \).
- The uncertainty in the slope, estimated from the residuals, is about 0.04.
- The uncertainty in the intercept is about 0.12.
- Forcing the line through the origin gives a slope of 2.00 as well, since the data are nearly linear.
Which are correct?
(a) 1 and 2 only (b) 1, 2 and 3 only (c) 1, 3 and 4 only (d) 1, 2, 3 and 4
Answer: (b) 1, 2 and 3 only
Sums: \( \sum x = 15 \), \( \sum y = 35 \), \( \sum xy = 125 \), \( \sum x^2 = 55 \), \( N = 5 \), \( \Delta = 5(55) - 15^2 = 50 \).
- \( m = (5 \times 125 - 15 \times 35)/50 = 100/50 = 2.00 \); \( c = \bar y - m\bar x = 7 - 2 \times 3 = 1.00 \). True.
- Residuals \( y - (2x + 1) \): −0.1, 0.1, 0.0, 0.1, −0.1; sum of squares 0.04; \( \sigma_y^2 = 0.04/3 = 0.0133 \). \( \sigma_m = \sqrt{0.0133 \times 5/50} = 0.037 \). True.
- \( \sigma_c = \sqrt{0.0133 \times 55/50} = 0.121 \). True.
- Through the origin: \( m = \sum xy/\sum x^2 = 125/55 = 2.27 \). The real intercept of 1 biases the slope. False.
Practice Q6. Three models are fitted by weighted least squares to the same 12 data points:
| Model | Parameters | \( \chi^2 \) |
|---|---|---|
| straight line | 2 | 31.0 |
| quadratic | 3 | 9.5 |
| cubic | 4 | 8.9 |
Consider:
- The straight line gives \( \chi^2_\nu \approx 3.1 \), a poor fit if the error bars are realistic.
- The quadratic gives \( \chi^2_\nu \approx 1.06 \).
- The cubic is clearly preferred because its \( \chi^2 \) is lowest.
- If the straight line had been the true model but the error bars were all underestimated by a factor of 2, \( \chi^2 \) would be about 4 times the expected value of 10.
Which are correct?
(a) 1 and 2 only (b) 1, 2 and 4 only (c) 2, 3 and 4 only (d) 1, 2, 3 and 4
Answer: (b) 1, 2 and 4 only
- \( \nu = 12 - 2 = 10 \); \( 31.0/10 = 3.1 \). True.
- \( \nu = 9 \); \( 9.5/9 = 1.06 \). True.
- Adding a parameter always lowers (or keeps) \( \chi^2 \). The cubic gives \( 8.9/8 = 1.11 \): no improvement in \( \chi^2_\nu \), so the extra parameter is not justified. False.
- \( \chi^2 \propto 1/\sigma^2 \): halving every \( \sigma \) multiplies \( \chi^2 \) by 4, giving about 40 instead of \( \nu = 10 \). True.
Practice Q7. The count from a short-lived source is recorded for 1 minute every 10 minutes:
| \( t \) (min) | 0 | 10 | 20 | 30 |
|---|---|---|---|---|
| counts | 1600 | 800 | 400 | 200 |
Background is negligible. Consider:
- A plot of \( \ln N \) against \( t \) is a straight line with slope about \( -0.069 \) min\( ^{-1} \).
- The half-life is 10 min.
- The relative uncertainty of the last point is about 7%, twice that of the second point.
- In a weighted fit of \( \ln N \) against \( t \), all four points should carry equal weight.
Which are correct?
(a) 1 and 2 only (b) 1, 2 and 3 only (c) 2, 3 and 4 only (d) 1, 2, 3 and 4
Answer: (b) 1, 2 and 3 only
- Each 10 min halves the count: slope \( = -\ln2/10 = -0.0693 \) min\( ^{-1} \). True.
- \( t_{1/2} = \ln2/\lambda = 10 \) min. True.
- \( 1/\sqrt{200} = 7.1\% \); \( 1/\sqrt{800} = 3.5\% \). Ratio 2. True.
- \( \sigma_{\ln N} = 1/\sqrt N \), so the weight is \( 1/\sigma^2 = N \): the first point carries 8 times the weight of the last. False.
Quick Revision Table
| Idea | Formula or fact |
|---|---|
| Sample SD | \( s = \sqrt{\sum(x_i - \bar x)^2/(N - 1)} \) |
| Standard error | \( s/\sqrt N \) |
| Gaussian | 68.3 / 95.4 / 99.7% within 1, 2, 3σ; FWHM \( 2.355\sigma \) |
| Poisson | \( \sigma_N = \sqrt N \); 1% needs \( 10^4 \) counts |
| Net rate | variances of signal and background add |
| Sum / difference | absolute errors in quadrature |
| Product / quotient | relative errors in quadrature |
| Power \( x^n \) | \( \lvert n\rvert\,\sigma_x/x \) |
| Weighted mean | \( w = 1/\sigma^2 \); \( \sigma = 1/\sqrt{\sum w} \) |
| LS slope | \( m = (N\sum xy - \sum x\sum y)/\Delta \) |
| LS intercept | \( c = \bar y - m\bar x \) |
| Slope error | \( \sigma_y\sqrt{N/\Delta} \), \( \sigma_y^2 = \sum r_i^2/(N - 2) \) |
| Through origin | \( m = \sum xy/\sum x^2 \) |
| Chi-square | \( \chi^2_\nu = \chi^2/(N - p) \approx 1 \) for a good fit |
| Averaging | SNR improves as \( \sqrt N \) |
Key Takeaways
What’s Next
- Electronics: Quick Revision: the whole chapter on one page.
- A/D and D/A Converters, Microprocessors and Microcontrollers: quantisation error is one more term in the error budget.
- Electronics and Experimental Methods (Core) overview.
- The same statistics, from the experimental-design side: Experimental Design, Sampling and Data.