1B40 DA Lecture 2v2
1B40 DA Lecture 2v2
1B40 DA Lecture 2v2
In this section we shall look at a few statistical ideas. However, to quote L.Hogben, “the
experimental scientist does not regard statistics as an excuse for doing bad experiments”.
30
N(x)
15
0
0 10 20 30 40
x
Figure 1. Frequency histogram of measurements
In order to provide some sort of description of this distribution we need measures of the x-value
at which it is centred and how wide it is, i.e. some measure of the scatter or dispersion about
this mean. The mean µ and mean square deviation s 2 (also called the variance) serve this
purpose.
For a set of n measurements the mean and variance are defined, respectively, by
1
1 n
x≡ x = ∑ xi ,
n i =1
1 n
∑ ( xi − µ ) ,
2
sn2 =
n i=1
where we use the symbol µ to denote the true mean of the infinite sample.
The histogram above is a close approximation to, what is called, a continuous frequency
distribution f ( x ) which would have been obtained for an infinite number of measurements. The
quantity f ( x ) dx is the probability of obtaining a measurement of x lying between x and
x + dx . The sum over all probabilities must be unity so the probability distribution must satisfy
the integral relation
∞
∫ f ( x ) dx = 1.
−∞
Since the number of measurements in the distribution is large and is (assumed to be) free of
systematic error x may be taken as equal to the true value of x. The variance is
∞ 2
σ2 =∫
−∞
( x − µ ) f (x ) dx.
The Gaussian function is relevant to many but not all random processes. The counting of the
arrival rate of particles in atomic and nuclear physics is better described by the Poisson
distribution. (There is a fuller discussion of these distributions in the lectures accompanying the
second-year laboratory course).
2
0.08
X = 20, σ = 5
0.06
f(x)
0.04
0.02
0
0 10 20 30 40
x
Figure 2. Normal distribution with µ = 20 and σ = 5.
Best estimate of the true value and the precision for a finite
sample
For a set of n measurements the mean and variance are defined earlier by
1 n 1 n
x ≡ x = ∑ xi , and sn = ∑ ( xi − µ ) ,
2 2
n i=1 n i=1
where we use µ to denote the true mean of the infinite sample.
Since, in general, the true mean is not known we estimate it by x and so write the variance as
1 n 1 n 2
sn = ∑ ( xi − x ) = ∑ d i ,
2 2
n i =1 n i=1
where the residual, d i , is the departure of each measurement from the mean,
d i = xi − x .
It seems plausible, and can be proved, that given a finite set of n measurements each of equal
quality, the larger we make n the nearer the mean x approaches µ.
The best estimate that can be made for σ, the (unknown) standard deviation of the infinite
population, would be expected to be given by the standard deviation sn of the n readings:
1 n
∑ ( xi − x ) ,
2
sn =
n i =1
3
with the expectation that sn approached σ as n becomes large. (This quantity is calculated by
the Excel function STDEVP – the standard deviation of the population.) However if only one
measurement is made then this leads to sn being zero which is unreasonable. The better estimate
of the standard deviation of the unknown parent distribution from which the sample of n values
of x i are drawn is given by
n
∑( x − x )
2
i
n
σ n = sn = i=1 .
n −1 n −1
For n = 1 this gives 0/0 which is acceptably indeterminate as we have no knowledge of σ from
one measurement, x1 , alone. Thus one measurement does not allow an estimate of the spread in
values if the true value is not known. The expression for the variance above is calculated by the
Excel function STDEV- the standard deviation of a sample.
It is worth noting for computational purposes that the variance formula may be written as
1 n n
s =
2
∑
n − 1 i =1
( xi − 〈 x〉 ) =
2
〈 x 2 〉 − 〈 x〉 2 ,
n −1
where 〈 x 2 〉 is defined by
1 n 2
x = ∑ xi .
2
n i=1
So it is not necessary to loop over the data twice, first to calculate x then to obtain s 2 , but
x and 〈 x 2 〉 can be calculated in the same loop.
It is important to realise that sn is a measure of how spread out the distribution is. It is not the
accuracy to which the mean value is known. This is known to an accuracy improved by a
factor √n as will be shown later, thus the more observations that are taken the better.
What we need to know is how the mean of our sample, comprised of n measurements of the
quantity x, would vary if we were to repeat the experiment a large number of times, taking n
readings each time and calculating the mean each time. The results for the mean value would be
4
slightly different. We could construct a frequency distribution of the mean values – not that of
the individual measurements which σ n measures – and determine the standard deviation of this
distribution. This quantity is σm – the standard error on the mean. The derivation in the
appendix shows that
σ
σm = .
n
The standard uncertainty on the mean, σm, reduces as the square root of the number of
measurements. Hence an increase in the number of readings lowers the uncertainty on the
mean!
Strictly speaking we don’t know the value of σ for the infinite sample. But we can make a
reasonable estimate for σ using
1 n
( xi − x )
n
n −1 ∑
2
σ = sn = .
n −1 i =1
Summary
If in an experiment we taken n measurements of a quantity x whose unknown
value is µ ,
1. the best estimate of µ is the mean
1 n
x = x = ∑ xi .
n i=1
2. the standard deviation, sn , of this (large) sample of n measurements is
n n
sn = ∑ ( xi − x ) / n = ∑ d i / n,
2 2 2
i =1 i =1
5
n
n ∑d i
2
σ n = sn = i =1
.
n −1 ( n − 1)
4. the standard error on the mean, σ m is given by
n
σ ∑ di2
σm = ; i =1
.
n n ( n − 1)
To use these results in practice find
• the mean of your readings as in step 1,
• the standard deviation of the residuals (step 2 or 3) provided you have
enough readings to make this sensible, say 8 or more. (Otherwise
estimate the uncertainty from the precision of the instrument),
• the standard error on the mean from step 4.
•
6
Appendix
N k =1 n i= 1 i≠ j
where eik is the error in reading i from the true value µ. for set k from the set N. The average
of the eik ejk terms will be zero as they are just as likely to be positive or negative, this yields
1 1 N n 2 1 n 1 N 2
E2 = ∑∑ eik = n 2 ∑
N n 2 k =1 i=1 ∑ eik .
i =1 N k =1
This is wholly equivalent to a sum of n data sets with (large) N readings (each measurement is a
random sample of the distribution). The quantity
1 N 2
∑ eik = σ 2
N k =1
can be used to measure the standard deviation of the sample and we have n of these so
1 n 1 N 1 σ2
E 2 = 2 ∑ ∑ eik2 = 2 ( nσ 2 ) = .
n i=1 N k =1 n n
Now E = σ m and hence we have finally that
2 2
1
σm = σ.
n
The best estimate for σ, which is not known, is the standard deviation of the subset of results
we have for our n measurements:
7
1 n 1 n
∑ ( xi − µ ) = ∑ ei2 ,
2
σn =
n i=1 n i=1
though where µ is not known. However instead of the errors ei from the unknown true mean
µ ,we have the deviations (residuals d i ) of each x i from the mean of the sample,
ei = xi − µ ,
di = x i − x .
The error, E on the mean is given by
E = x − µ ⇒ x = E + µ.
Combining these we have
d i = xi − ( E + µ ) ,
d i = e i − E.
Now sn the standard deviation of the sample is given by
1 1
s 2n = ∑ ( xi − x ) = ∑ ( ei − E ) ,
2 2
n i n i
1 1
s 2n = ∑ ei2 − 2 E ∑ ei + E 2 .
n i n i
Since
1 1
∑
n i
ei = ∑ ( xi − µ ) = x − µ .
n i
we then have
1 1
s 2n = ∑
n i
e2i − 2 E 2 + E 2 = ∑ e 2i − E 2.
n i
This is the standard deviation for one set of n measurements. As before we take the average of
this over a large number N of sets in the distribution and get
1
s 2n = ∑
n i
ei2 − E 2 = σ 2 − σ m2 .
1
s 2n = σ 2 1 − = σ 2
( n − 1) ,
n n
giving
n 1
σ2 = s n2 , σ m2 = s n2 .
n −1 ( n − 1)
Strictly the quantity sn2 obtained by averaging over a large number of sets of data is unknown.
The best estimate for this is sn2. Substituting this we obtain the following approximate relations
1 1
n 2 1 2
σ ≈ sn and σ m ≈ sn .
n −1 n −1
8
We now have expressions for σ and σm in terms of an experimentally measurable quantity.
Note that σ m may be reduced by taking more precise measurements or more readings
- OR BOTH.