Weighted average and fits: Chapters 7-8 Announcements: • The requirement that you attend 10 lab sections has been removed. You must take data during your normal lab section (unless you have made prior arrangements). However, if you only need to write up the lab, you do not need to attend your lab section. I DO encourage you to attend in order to get help or to check the lab for things you may have missed. • The deadline for Lab 2 has been extended: – Thursday section labs are due by 4pm on Monday, February 10 – Tuesday section labs are due by 4pm on Friday, February 14 • Remember, you need to do 6 labs. For at least 3 of them, you need a full lab report. For the remainder, putting the analysis in your lab notebook is fine. Should still make plots by computer and past them in. Need to have same information as in report but don’t need to strictly follow the format. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 1 Combining data • First you should check that the values you are combining are compatible. You can use the same test as you use to determine if your measured value is compatible with the known value. If the probability is small that the values are compatible, then it probably doesn’t make sense to average them. • If they are compatible, it is a good idea to average as you can get a more precise result. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 2 Weighted average • Take N measurements x1, x2, …, xN with uncertainties σ1, σ2, …, σN N ∑w x i i • Weighted average is xavg = i=1 N ∑w i 2 i i=1 • The weights are wi = 1 / σ • The uncertainty on xavg is σ avg = 1 N ∑w i i=1 • If σ1 = σ2 = … = σN = σ then weighted average is the simple average and the uncertainty is σ/√N. • Note that weights go as 1/σ2 so more precise measurements count much more than less precise measurements. • This is the simplest example of least squares fitting (a fit to a line with no slope).. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 3 • Suppose you make two measurements of g and find values of 9.802 ± 0.037 m/s2 and 9.774 ± 0.019 m/s2 • Check the discrepancy between the two numbers: 9.802 − 9.774 2 0.037 + 0.019 2 g (m/s2) Example of weighted average 9.84 9.82 9.8 = 0.67σ ✔ • The straight average would give 9.788 m/s2 • The weighted average is 9.780 ± 0.017 m/s2 Meas 2 9.78 Weighted Average Average 9.76 Meas 1 • The weighted average will have smaller uncertainty than any of the measurements that go into the average. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 4 Ways to use multiple measurements • Suppose you take N measurements of a quantity and you want to get the best estimate of that quantity. • Two approaches: A. Calculate the mean, the standard deviation (which gives you the uncertainty on each measurement), and the uncertainty on the mean (SD/√N). B. Calculate the weighted average with corresponding uncertainty. • In A, you are determining the uncertainties from the spread of data (good for large N), each of which is assumed to ~same. • In B, the mean uncertainty comes from the uncertainties from each measurement. • How do you choose which method to use? http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 5 Choosing way to combine measurements A. Calculate the mean, the standard deviation (which gives you the uncertainty on each measurement), and the uncertainty on the mean (SD/√N). • Must use if uncertainty of each measurement is not known. • Best if uncertainties on each measurement are not well known, the number of measurements is large (>10), and the uncertainties on each measurement are expected to be the same. B. Calculate the weighted average with corresponding uncertainty. • Can only use if you know the individual measurement uncertainties. • Should use if individual measurement uncertainties are well known and/or are not all the same. • Also useful in cases where the number of measurements is small (<10). http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 6 Example 1 • 10 measurements of a length (in cm): 9.0, 9.5, 9.8, 9.9, 10.0, 10.0, 10.1, 10.2, 10.5, 11.0 • Method A: Average = 10.0cm, SD = 0.54cm, Uncertainty = SD/ √N = 0.54cm/√10 = 0.17cm • Method B (assuming each measurement has an uncertainty of δ): Weighted average = 10.0cm, Uncertainty = δ/√N. – If we estimated our measurement uncertainty to be 0.54cm, we would get Uncertainty = 0.54cm/√10 = 0.17cm, same as before. – If we estimated our measurement uncertainty to be much smaller (0.1cm), our uncertainty on the mean is 0.1cm/√10 = 0.03cm. But then the spread of our measurements is not consistent with our estimated uncertainty on each measurement. • For this case, Method A is better because it is a relatively large number of measurements and the uncertainties on each measurement are known to be the same. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 7 Example 2 • Two measurements, using different techniques, are made of g and find values of 9.802 ± 0.037 m/s2 and 9.774 ± 0.019 m/s2 • Method A: Average = 9.788 m/s2, SD = 0.020 m/s2, Uncertainty = SD/√N = 0.020m/s2/√2 = 0.014 m/s2 • Method B: Weighted average = 9.780, Uncertainty is 0.017 m/s2. • For Method A, we are trying to determine the standard deviation and the uncertainty from just two measurements, which is technically possible but is not a good idea. For just two measurements, they may happen to lie close to each other (giving a small uncertainty) or far apart (giving a large uncertainty). Also, we know the two uncertainties are different so Method A is disfavored. • Method B is the correct method in this case: low number of measurements, well known measurement uncertainties, and different uncertainties for each measurement. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 8 Clicker question 1 Set frequency to AB • You take N measurements of a current in the e/m experiment using an analog mete and use Method A to determine the mean e/m, the standard deviation, and the uncertainty on the mean. • Now you start to think about systematic uncertainties. • You think of two systematic uncertainties related to the current: A. The meter is stated to have a potential bias of 0.001*I+0.01 A. B. Your reading of the meter could be off by 0.1A in either direction. Which of these should be included as systematic uncertainty? A) A only B) B only C) Both A and B D) Neither A nor B E) Depends on how big the statistical uncertainty is A is a potential systematic bias you should include. B is an uncertainty that should be accounted for by the statistical uncertainty. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 9 Clicker question 2 Set frequency to AB • You time the period of a pendulum 10 times with a stop watch. • The stop watch reports results to 1/100 of a second. What is the best way to determine the period? A) Take the weighted average of the 10 times, with an uncertainty for each time of 0.01 second, and use the calculated weighted average uncertainty (0.01s/√10 in this case) B) Take the simple average of the 10 times and use the uncertainty of the mean (SD/√10) as the uncertainty. C) As in A but also add 0.01s in quadrature as a systematic uncertainty. D) As in B but also add 0.01s in quadrature as a systematic uncertainty. The stop watch accuracy of 0.01s is not the limit on the accuracy, it is human error. Therefore, it is best to let the data determine the uncertainty on each measurement (the standard deviation). The 0.01s uncertainty from the stop watch is random so is included in the statistical uncertainty and should not be added as a systematic uncertainty. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 10 More general parameter estimation Weighted average for single parameter Sometimes data points lie on a line Example is photoelectric effect hf=Tmax+φ and eVs=Tmax Vs = (h/e)f + (φ/e) Strategy: plot Vs vs f Fit the data points to a line; slope gives (h/e) and intercept gives (φ/e). • If no uncertainties on measurements, slope and intercept uncertainties are obtained directly from data (linear fit). • If measurements have uncertainties, slope and intercept uncertainties are derived from them (weighted linear fit). E=h e + Vs = stopping voltage V • • • • • • • http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 11 Clicker question 3 Set frequency to AB The true value of the speed of light is c. If we make a measurement of the speed of light (x), with uncertainty σx, 2then " % the probability distribution is proportional to 1 exp $ − (x − c) ' 2 σx 2 σ # & x If we are measuring the stopping voltage as a function of light frequency, the measurements will not all be the same but will be of the form Vi = φ/e + (h/e)f or yi = A + Bxi. We make measurements of y with uncertainty of σy. What does the probability distribution look like for yi in this case? " (A + Bx)2 % 1 '' A) exp $$ − 2 σy 2σ y & # " (y + (A + Bx))2 % 1 '' C) exp $$ − 2 σy 2σ y # & http://www.colorado.edu/physics/phys2150/ " (y − (A + Bx))2 % 1 '' B) exp $$ − 2 σy 2σ y # & ! (A + Bx))2 $ ! y2 $ 1 && exp ## 2 && D) exp ## 2 σy " 2σ y % " 2σ y % Physics 2150 – Spring 2014 12 Fitting to a straight line • Measure N points: (x1,y1), (x2,y2),…,(xN,yN) with negligible uncertainty on x and σy uncertainty on all y measurements. • Assume measurements lie on line with y = A + Bx • For a given xi, fitted value of yi is A + Bxi # −(y − (A + Bx ))2 & 1 • Probability of obtaining yi is i ∝ exp % i ( σy 2σ y %$ (' • Probability of obtaining the set of measurements is the product of all the individual probabilities is 2 N 2& # yi − (A + Bxi )) 1 −χ ( 2 ∝ N exp % ( where χ = ∑ 2 σy σ $ 2 ' y i=1 • In general, find the values of A and B that maximize the probability (principle of maximum likelihood). • In this case, maximum probability is when χ2 is a minimum. • Here, can differentiate χ2 with respect to A and B and set to 0 to obtain A and B. http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 13 Equations χ2 fit to straight line for straight line fit Pages 183-184 of Taylor N N 2 2 ! ! ∂χ −2 −2 ∂χ (yi − A − Bxi ) = 0 xi (yi − A − Bxi ) = 0 = 2 = 2 ∂A σy i=1 ∂B σy i=1 can be rewritten as: ! ! AN + B xi = yi A which can be solved for: " 2" " " xi y i − xi xi y i A= ∆ " 2 " 2 where ∆ = N xi − ( xi ) ! xi + B B= N ! " x2i = xi y i − ∆ ! " xi y i xi " yi Problem 8.9, page 201 gives results for cases when uncertainties on yi are not all equal (weighted linear fit) http://www.colorado.edu/physics/phys2150/ January 31, 2006 Physics 2150 – Spring 2014 14 Physics 2150 Lecture 3 – p. 16 ! σ2 , B = 2 A = Estimating , 2∆ = N 2 xi − 2 y ∆ ∆ + 0.2 + 0.4 Estimating σy . . . 2.0 = 15.4 V ! ! xi = 0.0 xi = 0.0 + 0.2 + 0.4 . . . 2.0 = 11.0 V y = 0.0 + 1.1 + 2.3 . . . 12.1 =was: 65.8 cm i !Uncertainties Our standard deviation from many measurements ! 2 linear from unweighted fit 2 2 2 2 ! Our standard deviation from many measuremen x = 0.0 + 0.2 + 0.4 . . . 2.0 = 15.4 V " x y = 0.0 · 0.0 + 0.2 · 1.1 + 0.4 · 2.3 . . . 2.0 · ! i N i i ! 2 !"N 2 (xiwas: −! x) 2 • The standard deviation i=1 2 2 y = 0.0 + 1.1 + 2.3 . . . 12.1 = 65.8 cm (x − x) σ = i i x ∆ = N x − ( x ) = 11 × 15.4 − 11.0 = i=1 i ! iσx = N −1 1. 2.0 xi y i = 0.0 · 0.0 + 0.2 + 0.4 . . · 12.1 = 92.48 V x2i· 1.1 yi − xi · 2.3 xiN yi − 15.4×65.8−11.0×92.48 !The ! of=N −2 of 1 instead of Nfrom cameusing from x48.4 instead =1 instead = • The factor of2factor N-1A instead N The comes the average 2 of 2 using ∆ factor of N − of N came from us ∆ = N x − ( x ) = 11 × 15.4 − 11.0 = 48.4 V i (unknown) µ true ithan the N value. xi yi(unknown) − xi yµ 11×92.48−11.0×65.8 i value rather B = = = 6.0 2 xi yi − xi xi yi ∆ 48.4 15.4×65.8−11.0×92.48 Similar result for estimating theresult uncertainy in = y: −0.08 • ASimilar for estimating the uncertainty in measured yuncertainy = cm = result ! Similar for estimating the in yo ∆ " 48.4 ! From spread of measurements, find uncertainty values: N xi yi − xi N y(y 11×92.48−11.0×65.8 i" −A − Bxi )2 "2N (yi −=A6.06 2 B= cm/V = kC i=1 i= − Bx ) i i=1 σy =∆ (yiσ −A−Bx ) 48.4 i = σy = N − 2 Ny −2 = 0.14 cm = σD N − 2 spread measurements, find (A,B) uncertainty ondata, y, A,N and B: • From Since" we Here nowof derive two parameters from the gets " Here the expected value for yithe is expected A + Bxi" instead value forof yi xisand A +we Bxhave i inste ting replaced a line by (2) 2 2 N-2. (y −A−Bx ) x i 2 instead i of N due to iguessing on A and 15.4 N− Bto(for N = 2on we are B N − 2 instead of N due guessing A and σy = = 0.14 cm = σ σ = σ = 0.14 × = 0.08 cm D A y Non −2A and B are found ∆ line 48.4 • Uncertainties to be: guaranteed to have a perfect and therefore on guaranteed to have a perfect line and therefore easurements of"x and y can be fit to line of form"y = AnoCalibration +information Bx: " " cons ! ! uncertainties) x2i yi − xi uncertainties) xi yix2 2 x y − x y N N 11 i i 15.4where i i 2 i B σ = σ = 0.14 × = 0.07 cm/V , = , ∆ = N x −( x ) y i σA = =B0.14 × ∆48.4 = 0.08 cm48.4 kCi = (6.06±0.0 ∆ σy ∆ "0.4 . . . 2.0 = 11.0 " = 0.0 + 0.2 + V7, can February11 2006be found in Problem 8.19 (p. P i • Uncertainties fit N from weighted σ204). σy2 + ∆ = =2 0.07 cm/V 2 2 0.14 × 2 B+= 48.4 = 0.0 0.2 0.4 . . . 2.0 = 15.4 V January 31, 2006 January 31, 2006 Physics 2150 Lecture 3 – p.Physi 17 i • Follow same fit asPhysics for weighted/ = 0.0 + 1.1 + 2.3 .2006 . . 12.1for=weighted/unweighted 65.8 cm February 7, criteria 2150 Lecture unweighted average. 0.0 · 0.0 + 0.2 . . . 2.0 · 12.1 = 92.48 V · cm15 i yi =http://www.colorado.edu/physics/phys2150/ Physics 2150 – Spring 2014 ! 2 ! 2 · 1.1 + 0.4 · 2.3 N xi − ( xi ) = 11 × 15.4 − 11.02 = 48.4 V2