# Lecture 7 Error on the mean (review from Lecture 4)

by user

on
1

views

Report

#### Transcript

Lecture 7 Error on the mean (review from Lecture 4)
```Lecture 7
Some Advanced Topics using Propagation of Errors and Least Squares Fitting
Error on the mean (review from Lecture 4)
●
!
Question: If we have a set of measurements of the same quantity:
x1 ± " 1 x2 ± " 2 ... x n ± " n
◆ What's the best way to combine these measurements?
◆ How to calculate the variance once we combine the measurements?
◆ Assuming Gaussian statistics, the Maximum Likelihood Methods combine the measurements as:
n
# xi / " i2
x = i=1n
weighted average
2
#1/ " i
i=1
◆
!
!
◆
If all the variances ( " 12 = " 22 = ..." n2 ) are the same:
1 n
unweighted average
x = " xi
n i=1
The variance!of the weighted average can be calculated using propagation of errors:
2
n\$ # '
n
n
1/ " i4
1
2
2
2
" x = * & x) " i = *
"
=
*1/ " i2
i
2
2
\$n
i=1%#xi (
i=1\$ n
2'
2 ' i=1
1/
"
1/
"
*
*
&
i)
&
i)
%i=1
(
%i=1
(
1
" 2x = n
σx is the error in the weighted mean
2
*1/ " i
i=1
K.K. Gan
!
1
If all the variances are the same:
n
"2
2
2
2
Lecture 4
" x = 1/ #1/ " i = 1/[n / " ] =
n
i=1
☞ The error in the mean (σx) gets smaller as the number of measurements (n) increases.
■ Don't confuse the error in the mean (σx) with the standard deviation of the distribution (σ)!
100
■ If we make more measurements
µ = 20.0
80
☞ the standard deviation (σ) of the distribution remains the same 60
σµ = 0.2
400 data points
40
☞ the error in the mean (σx) decreases
σ = 4.0
dN/dy
◆
!
20
0 0
More on Least Squares Fit (LSQF)
●
●
10
20
y
30
40
In Lec 5, we discussed how we can fit our data points to a linear function (straight line) and get the
"best" estimate of the slope and intercept. However, we did not discuss two important issues:
◆ How to estimate the uncertainties on our slope and intercept obtained from a LSQF?
◆ How to apply the LSQF when we have a non-linear function?
Estimation of Errors from a LSQF
◆ Assume we have data points that lie on a straight line:
y = α + βx
■ Assume we have n measurements of x's and y's.
■ For simplicity, assume that each y measurement has the same error σ.
■ Assume that x is known much more accurately than y.
☞ ignore any uncertainty associated with x.
■ Previously we showed that the solution for the intercept α and slope β is:
n
n
n
n
n
n
n
2
n # xi yi \$ # xi # yi
# yi # xi \$ # xi yi # xi
i=1
i=1
i=1 i=1
" = i=1 i=1
and % = i=1n
n
n
n
2
2
2
n # xi \$ ( # xi )
n # xi \$ ( # xi ) 2
K.K. Gan
!
i=1
i=1
i=1
i=1
2
■
Since α and β are functions of the measurements (yi's)
☞ use the Propagation of Errors technique to estimate σα and σβ.
2
2
\$ #Q '\$ #Q '
2
2 \$ #Q '
2 \$ #Q '
" Q = " x & ) + " y & ) + 2" xy & )& )
% #x (
% #x (% #y (
% #y (
★ Assumed that each measurement is independent of each other:
!
" Q2
2
2
2 \$ #Q '
2 \$ #Q '
= " x& ) +" y& )
" *2
2
2 \$ #* '
= + " yi & )
% #yi (
i=1
% #x (
% #y (
n
n
\$ #* '2
= " +& )
i=1% #yi (
2
n
n
n
n
n
n
2
2
+ yi + x j , + xi yi + x j
+ x j , xi + x j
#* # i=1 j=1
i=1
j=1
j=1
=
= j=1
n
n
n
n
#yi #yi
n + xi2 , ( + xi )2
n + xi2 , ( + xi )2
i=1
i=1
i=1
i=1
n
n
n
\$ n 2
'2
\$ n 2 2 2 n
2
2'
x
,
x
x
(
x
)
+
x
(
x
)
,
2x
x
x
+
+
+
+
+
+
j
i
j )
j
i
j
i
j
j)
n&
n&
j=1
j=1
j=1
j=1
j=1
2
2 & j=1
2
) = " +&
)
"* = " + n
n
n
n
)
2
2 2
i=1& n + x 2 , ( + x )2 )
i=1&
(n
x
,
(
x
)
)
+
+
i
i )
i
i
&
&
)
i=1
i=1
i=1
% i=1
(
%
(
!
K.K. Gan
3
n
" #2
" #2
★
!
n
n
n
n
2 2
2
2
2
n( \$ x j ) + \$ xi ( \$ x j ) % 2( \$ x j ) \$ x 2j
i=1
j=1
j=1
j=1
2
= " 2 j=1
=
"
n
n
(n \$ xi2 % ( \$ xi )2 )2
i=1
i=1
n
n
2
n \$ x j % ( \$ x j )2
n
j=1
2
= " \$ x 2j j=1
n
n
j=1 (n x 2 % ( x )2 )2
\$ i
\$ i
i=1
i=1
n
\$ x 2j
variance in the intercept
= " 2 n j=1 n
n \$ xi2 % ( \$ xi )2
i=1
i=1
n
n
2 2
2
n( \$ x j ) % \$ xi ( \$ x j )2
j=1
i=1
j=1
n
n
(n \$ xi2 % ( \$ xi )2 )2
i=1
i=1
We can find the variance in the slope (β) using exactly the same procedure:
n
%
(2
n
n
n
%
(2
nxi , + x j *
n + xi yi , + xi + yi *
2
2
n
n % \$# (
n' \$
n'
%
(
\$#
j=1
i=1
i=1 i=1 * = " 2 + '
*
" #2 = + " 2y i ' * = " 2 + ' * = " 2 + '
n
n
n
n
& \$yi )
i=1
i=1& \$yi )
i=1' \$yi n + x 2 , ( + x )2 *
i=1' n + x 2 , ( + x )2 *
'
*
i
i
i
i *
'
&
)
i=1
i=1
i=1
& i=1
)
n
="2
K.K. Gan
!
n
2
n
n
n
n
2
2
+ x j + n( + x j ) , 2n + xi + x j
j=1
j=1
i=1 j=1
n
n
(n + xi2 , ( + xi )2 )2
i=1
i=1
n
2
n + x j , n( + x j )2
j=1
= " 2 j=1
n
n
(n + xi2 , ( + xi )2 )2
i=1
i=1
2
n
4
" #2
n" 2
=
n
n \$ xi2
i=1
n
% ( \$ xi )
2
variance in the slope
i=1
If we don't know the true value of σ,
☞ estimate variance using the spread between the measurements (yi’s) and the fitted values of y:
!
1 n
1 n
2
fit 2
" #
% (yi \$ yi ) =
% (yi \$ & \$ 'xi )2
n \$ 2 i=1
n \$ 2 i=1
★ n − 2 = number of degree of freedom
= number of data points − number of parameters (α, β) extracted from the data
■ If each yi measurement has a different error σi:
!
1 n xi2
2
"# = \$ 2
D i=1" i
■
" %2
1 n 1
= \$ 2
D i=1" i
weighted slope and intercept
n x
1 n xi2
D = \$ 2 \$ 2 & ( \$ i2 )2
i=1" i i=1" i
i=1" i
The above expressions simplify to the “equal variance” case.
❒ Don't forget to keep track of the “n’s” when factoring out σ. For example:
n 1
n
1
# 2 = 2 not 2
"
"
i=1" i
n
★
!
K.K. Gan
!
5
●
LSQF with non-linear functions:
◆ For our purposes, a non-linear function is a function where one or more of the parameters that
we are trying to determine (e.g. α, β from the straight line fit) is raised to a power other than 1.
■ Example: functions that are non-linear in the parameter τ:
y = A + x /"
y = A + x" 2
!
y = Ae#x / "
★ These functions are linear in the parameters A.
◆ The problem with most non-linear functions is that we cannot write down a solution for
the parameters in a closed form using, for example, the techniques of linear algebra (i.e. matrices).
!
■ Usually non-linear problems are solved numerically using a computer.
■ Sometimes by a change of variable(s) we can turn a non-linear problem into a linear one.
★ Example: take the natural log of both sides of the above exponential equation:
ln y = ln A " x / # = C " Dx
❒ A linear problem in the parameters C and D!
❒ In fact its just a straight line!
☞ To measure the lifetime τ (Lab 6) we first fit for D and then transform D into τ.
!
◆ Example: Decay of a radioactive substance. Fit the following data to find N0 and τ:
N = N 0 e"t / #
■ N represents the amount of the substance present at time t.
■ N0 is the amount of the substance at the beginning of the experiment (t = 0).
■ τ is the lifetime of the substance.
K.K. Gan
6
i
1
2
3
4
5
6
7
8
9
10
ti
0
15
30
45
60
75
90
105
120
135
Ni
106
80
98
75
74
73
49
38
37
22
yi = ln Ni 4.663
4.382
4.585
4.317
4.304
4.290
3.892
3.638
3.611
3.091
n
n
n
n \$ xi yi " \$ yi \$ xi
D = "# = "
i=1
n
i=1 i=1
n
2
n \$ xi " ( \$ xi ) 2
i=1
i=1
="
10 % 2560.41" 40.773% 675
= 0.01033
2
10 % 64125 " (675)
& = 1/ D = 96.80 sec
■
The intercept is given by: C = 4.77 = ln A or A = 117.9
5
y = 4.7746 + -0.010331x R= 0.93518
!
Y(x)
lnN(t)
4.5
4
3.5
3
-20
K.K. Gan
0
20
40
60
x
t
80 100 120 140
7
◆
!
!
!
Example: Find the values A and τ taking into account the uncertainties in the data points.
■ The uncertainty in the number of radioactive decays is governed by Poisson statistics.
■ The number of counts Ni in a bin is assumed to be the average (µ) of a Poisson distribution:
µ = Ni = Variance
■ The variance of yi (= ln Ni) can be calculated using propagation of errors:
2
2
2
" 2y = " N2 (#y / #N ) = (N)(# ln N / #N ) = (N)(1/ N ) = 1/ N
■ The slope and intercept from a straight line fit that includes uncertainties in the data points:
n y n x2
n x y n x
n 1 n x y
n x n y
i
i %
i i
i
i i %
\$ 2\$ 2 \$ 2 \$ 2
\$ 2 \$ 2 \$ i2 \$ i2
#
#
#
#
#
#
#
#
Taylor P. 198
" = i=1 i i=1 i 2 i=1 i i=1 i and & = i=1 i i=1 i 2 i=1 i i=1 i
n 1 n x
n x
n 1 n x
n x
and Problem 8.9
i %(
i )2
i %(
i )2
\$ 2\$ 2 \$ 2
\$ 2\$ 2 \$ 2
#
#
#
i=1 i i=1 i
i=1 i
i=1# i i=1# i
i=1# i
★ If all the σ's are the same then the above expressions are identical to the unweighted case.
" = 4.725 and # = \$0.00903
τ = -1/β = 1/0.00903 = 110.7 sec
■ To calculate the error on the lifetime, we first must calculate the error on β:
n 1
\$ 2
652
i=1" i
%6
" #2 =
=
=
1.01&10
n 1 n x2
n x
652 & 2684700 % (33240)2
i %(
i )2
\$ 2\$ 2 \$ 2
i=1" i i=1" i
i=1" i
1.005 &10 %3
= 12.3
((' /(# ) ) " ' = " # 1/ # =
%3 2
(9.03&10 )
τ = 110.7 ± 12.3 sec.
" '2
☞
K.K. Gan
!
= " #2
2
(
2
)