You are on page 1of 8

Lecture 7 Some Advanced Topics using Propagation of Errors and Least Squares Fitting

Error on the mean (review from Lecture 4)


l

Question: If we have a set of measurements of the same quantity: x1 s 1 x2 s 2 ... x n s n u What's the best way to combine these measurements? u How to calculate the variance once we combine the measurements? u Assuming Gaussian statistics, the Maximum Likelihood Methods combine the measurements as: n xi / s i2 x = i=1 weighted average n 2 1/ s i
u
2 2 2 If all the variances ( s 1 = s 2 = ...s n ) are the same: 1 n x = xi unweighted average n i=1 The varianceof the weighted average can be calculated using propagation of errors: 2 n n n 1/ s i4 1 2 2 s x = x s i = s i2 = 1/ s i2 2 2 n i=1xi i=1 n 2 2 i=1 1/ s i 1/ s i i=1 i=1 1 s2 = n sx is the error in the weighted mean x 2 1/ s i

i=1

i=1

K.K. Gan

L7: Some Advanced Topics

If all the variances are the same: n s2 2 2 2 Lecture 4 s x = 1/ 1/ s i = 1/[n / s ] = n i=1 + The error in the mean (sx) gets smaller as the number of measurements (n) increases. n Don't confuse the error in the mean (sx) with the standard deviation of the distribution (s)! n If we make more measurements + the standard deviation (s) of the distribution remains the same + the error in the mean (sx) decreases

More on Least Squares Fit (LSQF)


l

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: u How to estimate the uncertainties on our slope and intercept obtained from a LSQF? u How to apply the LSQF when we have a non-linear function? Estimation of Errors from a LSQF u Assume we have data points that lie on a straight line: y = a + bx n Assume we have n measurements of y's. n For simplicity, assume that each y measurement has the same error s. n Assume that x is known much more accurately than y. + ignore any uncertainty associated with x. n Previously we showed that the solution for a and b 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 a = i=1 i=1 and b = i=1n n n n 2 2 2 n xi - ( xi ) n xi - ( xi )2
K.K. Gan
i=1 i=1

L7: Some Advanced Topics

i=1

i=1

Since a and b are functions of the measurements (yi's) + use the Propagation of Errors technique to estimate sa and sb. 2 2 Q Q 2 2 Q 2 Q s Q = s x + s y + 2s xy x x y y H Assumed that each measurement is independent of each other:
2 sQ 2 2 2 Q 2 Q = s x +s y

y
2 n

2 sa

2 2 a = s yi yi i=1 n n n

a 2 = s i=1 yi
n n 2 x j - xi x j n n i=1 n j=1 j=1 n j=1 n

a = yi yi

2 yi x j - xi yi x j i=1

n xi2 - ( xi )2
i=1 i=1

j=1 n

n xi2 - ( xi )2
i=1 i=1

n n n n 2 2 n 2 2 2 n ( x j ) + xi ( x j )2 - 2xi x j x 2 x j - xi x j j n n j=1 j=1 j=1 j=1 2 2 j=1 2 j=1 =s sa = s n n n n 2 i=1 n x 2 - ( x )2 i=1 (n xi - ( xi )2 )2 i i i=1 i=1 i=1 i=1

K.K. Gan L7: Some Advanced Topics 3

2 sa

2 sa

We can find the variance in the slope (b) using exactly the same procedure: n 2 n n n 2 nxi - x j n xi yi - xi yi 2 n n b n n b 2 j=1 2 i=1 i=1 i=1 = s 2 s b = s 2i = s 2 = s 2 n y 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 =s2
2 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 n 2 n x j - n( x j )2 j=1 = s 2 j=1 n n (n xi2 - ( xi )2 )2 i=1 i=1 2 n

n n n n 2 2 2 2 2 n( x j ) + xi ( x j ) - 2( x j ) x 2 j j=1 i=1 j=1 j=1 j=1 2 =s =s2 n n (n xi2 - ( xi )2 )2 i=1 i=1 n n 2 n x j - ( x j )2 n j=1 2 = s x 2 j=1 j n n j=1 (n x 2 - ( x )2 )2 i i i=1 i=1 n 2 xj variance in the intercept = s 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

K.K. Gan

L7: Some Advanced Topics

2 sb

ns 2 n xi2 i=1
n

- ( xi )
i=1

variance in the slope

If we don't know the true value of s, + estimate variance using the spread between the measurements (yis) and the fitted values of y: 1 n 1 n 2 fit 2 s (yi - yi ) = (yi - a - bxi )2 n - 2 i=1 n - 2 i=1 H n - 2 = number of degree of freedom = number of data points - number of parameters (a, b) extracted from the data n If each yi measurement has a different error si: 1 n xi2 2 sa = 2 D i=1s i
n

2 sb

1 n 1 = 2 D i=1s i
n

weighted slope and intercept

n x 1 n xi2 D = 2 2 - ( i2 )2 i=1s i i=1s i i=1s i The above expressions simplify to the equal variance case. r Don't forget to keep track of the ns when factoring out s. For example: n 1 n 1 2 = 2 not 2 s s i=1s i

K.K. Gan

L7: Some Advanced Topics

LSQF with non-linear functions: u 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. a, b from the straight line fit) is raised to a power other than 1. n Example: functions that are non-linear in the parameter t: y = A + x /t
y = A + xt 2

y = Ae-x / t H These functions are linear in the parameters A. u 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). n Usually non-linear problems are solved numerically using a computer. n Sometimes by a change of variable(s) we can turn a non-linear problem into a linear one. H Example: take the natural log of both sides of the above exponential equation: ln y = ln A - x / t = C - Dx r A linear problem in the parameters C and D! r In fact its just a straight line! + To measure the lifetime t (Lab 6) we first fit for D and then transform D into t. Example: Decay of a radioactive substance. Fit the following data to find N and t: u 0 -t / t N = N0e n N represents the amount of the substance present at time t. n N0 is the amount of the substance at the beginning of the experiment (t = 0). n t is the lifetime of the substance.
K.K. Gan L7: Some Advanced Topics 6

i ti Ni yi = ln Ni

1 0 106 4.663
n i=1 n

2 15 80 4.382
n

3 30 98 4.585
n

4 45 75 4.317

5 60 74 4.304

6 75 73 4.290

7 90 49 3.892

8 105 38 3.638

9 120 37 3.611

10 135 22 3.091

n xi yi - yi xi D = -b = 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)

t = 1/ D = 96.80 sec
n

The intercept is given by: C = 4.77 = ln A or A = 117.9


5 y = 4.7746 + -0.010331x R= 0.93518

4.5
Y(x) lnN(t)

4 3.5 3 -20

20

40

60
x

80 100 120 140

K.K. Gan

L7: Some Advanced Topics

Example: Find the values A and t taking into account the uncertainties in the data points. n The uncertainty in the number of radioactive decays is governed by Poisson statistics. n The number of counts Ni in a bin is assumed to be the average (m) of a Poisson distribution: m = Ni = Variance n The variance of yi (= ln Ni) can be calculated using propagation of errors: 2 2 2 2 s 2 = s N (y / N ) = (N)( ln N / N ) = (N)(1/ N ) = 1/ N y 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 s s s s s s s s Taylor P. 198 a = i=1 i i=1 i 2 i=1 i i=1 i and b = 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 s i i=1s i si i=1 i=1 i=1s i i=1s i i=1s i H If all the s's are the same then the above expressions are identical to the unweighted case. a = 4.725 and b = -0.00903 t = -1/b = 1/0.00903 = 110.7 sec n To calculate the error on the lifetime, we first must calculate the error on b: n 1 2 652 i=1s i 2 sb = = = 1.0110 -6 n 1 n x2 n x 652 2684700 - (33240)2 i -( i )2 2 2 2 i=1s i i=1s i i=1s i
1.005 10 -3 = 12.3 (t /b ) s t = s b 1/ b = -3 2 (9.0310 ) The experimentally determined lifetime is t = 110.7 12.3 sec.
2 st 2 = sb 2

K.K. Gan

L7: Some Advanced Topics

You might also like