weighted average and fits: chapters 7-8€¦ · 1 weighted average and fits: chapters 7-8 • the...

15
http://www.colorado.edu/physics/phys2150/ 1 Weighted average and fits: Chapters 7-8 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. Physics 2150 – Spring 2014 Announcements:

Upload: hoangthuy

Post on 09-Jul-2018

260 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 1

Weighted average and fits: Chapters 7-8

•  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.

Physics 2150 – Spring 2014

Announcements:

Page 2: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 2

Combining data

Physics 2150 – Spring 2014

•  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.

Page 3: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 3

Weighted average

Physics 2150 – Spring 2014

•  Take N measurements x1, x2, …, xN with uncertainties σ1, σ2, …, σN

•  Weighted average is •  The weights are •  The uncertainty on xavg is

•  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)..

xavg =wixi

i=1

N

wii=1

N

∑wi =1/σ i

2

σ avg =1

wii=1

N

Page 4: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 4

Example of weighted average

Physics 2150 – Spring 2014

•  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:

•  The straight average would give 9.788 m/s2

•  The weighted average is 9.780 ± 0.017 m/s2

9.802− 9.774

0.0372 + 0.0192= 0.67σ ✔

g (m

/s2 )

9.76

9.78

9.8

9.82

9.84

Meas 1

Meas 2

g (m

/s2 )

9.76

9.78

9.8

9.82

9.84

Meas 1

Meas 2

Average

g (m

/s2 )

9.76

9.78

9.8

9.82

9.84

Meas 1

Meas 2

Average

WeightedAverage

•  The weighted average will have smaller uncertainty than any of the measurements that go into the average.

Page 5: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 5

Ways to use multiple measurements

Physics 2150 – Spring 2014

•  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?

Page 6: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 6

Choosing way to combine measurements

Physics 2150 – Spring 2014

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).

Page 7: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 7

Example 1

Physics 2150 – Spring 2014

•  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.

Page 8: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 8

Example 2

Physics 2150 – Spring 2014

•  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.

Page 9: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 9

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

Clicker question 1 Set frequency to AB

Physics 2150 – Spring 2014

•  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.

A is a potential systematic bias you should include. B is an uncertainty that should be accounted for by the statistical uncertainty.

Page 10: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 10

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.

Clicker question 2 Set frequency to AB

Physics 2150 – Spring 2014

•  You time the period of a pendulum 10 times with a stop watch. •  The stop watch reports results to 1/100 of a second.

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.

Page 11: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 11

More general parameter estimation

Physics 2150 – Spring 2014

•  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). i

Vi

V

E = h i

e

ï+Vs = stopping voltage

ï

Page 12: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 12

What does the probability distribution look like for yi in this case?

Clicker question 3 Set frequency to AB

Physics 2150 – Spring 2014

The true value of the speed of light is c. If we make a measurement of the speed of light (x), with uncertainty σx, then the probability distribution is proportional to 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.

1σ x

exp −(x − c)2

2σ x2

"

#$

%

&'

A) 1σ y

exp −(A+Bx)2

2σ y2

"

#$$

%

&'' B) 1

σ y

exp −(y− (A+Bx))2

2σ y2

"

#$$

%

&''

C) 1σ y

exp −(y+ (A+Bx))2

2σ y2

"

#$$

%

&'' D) 1

σ y

exp (A+Bx))2

2σ y2

!

"##

$

%&&exp y2

2σ y2

!

"##

$

%&&

Page 13: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 13

Fitting to a straight line

Physics 2150 – Spring 2014

•  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 •  Probability of obtaining yi is

•  Probability of obtaining the set of measurements is the product of all the individual probabilities is

•  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.

∝ 1σ y

exp −(yi − (A+Bxi ))2

2σ y

#

$%%

&

'((

∝ 1σ y

N exp −χ 2

2#

$%

&

'( where χ 2 =

yi − (A+Bxi )( )2

σ y2

i=1

N

Page 14: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/ 14

Equations for straight line fit

Physics 2150 – Spring 2014

χ2 fit to straight line

∂χ2

∂A=

−2

σ2y

N!

i=1

(yi − A − Bxi) = 0∂χ2

∂B=

−2

σ2y

N!

i=1

xi(yi − A − Bxi) = 0

can be rewritten as:

AN + B!

xi =!

yi A!

xi + B!

x2i =

!

xiyi

which can be solved for:

A =

"

x2i

"

yi −"

xi

"

xiyi

∆B =

N"

xiyi −"

xi

"

yi

where ∆ = N"

x2i − (

"

xi)2

Problem 8.9, page 201 gives results for cases when uncertainties on yi arenot all equal (weighted linear fit)

January 31, 2006 Physics 2150 Lecture 3 – p. 16

Pages 183-184 of Taylor

Page 15: Weighted average and fits: Chapters 7-8€¦ ·  1 Weighted average and fits: Chapters 7-8 • The requirement that you attend 10 lab sections has been

http://www.colorado.edu/physics/phys2150/

Estimating σy

Our standard deviation from many measurements was:

σx =

!

"Ni=1

(xi − x)2

N − 1

The factor of N − 1 instead of N came from using x instead of(unknown) µSimilar result for estimating the uncertainy in y:

σy =

!

"Ni=1

(yi − A − Bxi)2

N − 2

Here the expected value for yi is A + Bxi instead of x and we haveN − 2 instead of N due to guessing on A and B (for N = 2 we areguaranteed to have a perfect line and therefore no information onuncertainties)

January 31, 2006 Physics 2150 Lecture 3 – p. 17

Estimating σy

Our standard deviation from many measurements was:

σx =

!

"Ni=1

(xi − x)2

N − 1

The factor of N − 1 instead of N came from using x instead of(unknown) µSimilar result for estimating the uncertainy in y:

σy =

!

"Ni=1

(yi − A − Bxi)2

N − 2

Here the expected value for yi is A + Bxi instead of x and we haveN − 2 instead of N due to guessing on A and B (for N = 2 we areguaranteed to have a perfect line and therefore no information onuncertainties)

January 31, 2006 Physics 2150 Lecture 3 – p. 17

15

Uncertainties from unweighted linear fit

Physics 2150 – Spring 2014

•  The standard deviation was: •  The factor of N-1 instead of N comes from using the average

value rather than the true value. •  Similar result for estimating the uncertainty in measured y

values: •  Since we now derive two parameters (A,B) from the data, N gets

replaced by N-2. •  Uncertainties on A and B are found to be:

•  Uncertainties from weighted fit can be found in Problem 8.19 (p. 204).

•  Follow same criteria for weighted/unweighted fit as for weighted/unweighted average.

Fitting a line (2)N measurements of x and y can be fit to line of form y = A + Bx:A = x2

i yi− xi xiyi

∆ , B = N xiyi− xi yi

∆ , ∆ = N!

x2i −(

!

xi)2

!

xi = 0.0 + 0.2 + 0.4 . . . 2.0 = 11.0V!

x2i = 0.0 + 0.22 + 0.42 . . . 2.02 = 15.4V2

!

yi = 0.0 + 1.1 + 2.3 . . . 12.1 = 65.8 cm!

xiyi = 0.0 · 0.0 + 0.2 · 1.1 + 0.4 · 2.3 . . . 2.0 · 12.1 = 92.48V · cm∆ = N

!

x2i − (

!

xi)2 = 11 × 15.4 − 11.02 = 48.4V2

A = x2i yi− xi xiyi

∆ = 15.4×65.8−11.0×92.4848.4 = −0.08 cm

B = N xiyi− xi yi

∆ = 11×92.48−11.0×65.848.4 = 6.06 cm/V = kC

From spread of measurements, find uncertainty on y, A, and B:

σy ="

(yi−A−Bxi)2

N−2 = 0.14 cm = σD

σA = σy

"

x2i

∆ = 0.14 ×"

15.448.4 = 0.08 cm

σB = σy

"

N∆ = 0.14 ×

"

1148.4 = 0.07 cm/V

Calibration constant kC:kC = (6.06±0.07) cm/V

February 7, 2006 Physics 2150 Lecture 4 – p. 6

Fitting a line (2)N measurements of x and y can be fit to line of form y = A + Bx:A = x2

i yi− xi xiyi

∆ , B = N xiyi− xi yi

∆ , ∆ = N!

x2i −(

!

xi)2

!

xi = 0.0 + 0.2 + 0.4 . . . 2.0 = 11.0V!

x2i = 0.0 + 0.22 + 0.42 . . . 2.02 = 15.4V2

!

yi = 0.0 + 1.1 + 2.3 . . . 12.1 = 65.8 cm!

xiyi = 0.0 · 0.0 + 0.2 · 1.1 + 0.4 · 2.3 . . . 2.0 · 12.1 = 92.48V · cm∆ = N

!

x2i − (

!

xi)2 = 11 × 15.4 − 11.02 = 48.4V2

A = x2i yi− xi xiyi

∆ = 15.4×65.8−11.0×92.4848.4 = −0.08 cm

B = N xiyi− xi yi

∆ = 11×92.48−11.0×65.848.4 = 6.06 cm/V = kC

From spread of measurements, find uncertainty on y, A, and B:

σy ="

(yi−A−Bxi)2

N−2 = 0.14 cm = σD

σA = σy

"

x2i

∆ = 0.14 ×"

15.448.4 = 0.08 cm

σB = σy

"

N∆ = 0.14 ×

"

1148.4 = 0.07 cm/V

Calibration constant kC:kC = (6.06±0.07) cm/V

February 7, 2006 Physics 2150 Lecture 4 – p. 6

where

Fitting a line (2)N measurements of x and y can be fit to line of form y = A + Bx:A = x2

i yi− xi xiyi

∆ , B = N xiyi− xi yi

∆ , ∆ = N!

x2i −(

!

xi)2

!

xi = 0.0 + 0.2 + 0.4 . . . 2.0 = 11.0V!

x2i = 0.0 + 0.22 + 0.42 . . . 2.02 = 15.4V2

!

yi = 0.0 + 1.1 + 2.3 . . . 12.1 = 65.8 cm!

xiyi = 0.0 · 0.0 + 0.2 · 1.1 + 0.4 · 2.3 . . . 2.0 · 12.1 = 92.48V · cm∆ = N

!

x2i − (

!

xi)2 = 11 × 15.4 − 11.02 = 48.4V2

A = x2i yi− xi xiyi

∆ = 15.4×65.8−11.0×92.4848.4 = −0.08 cm

B = N xiyi− xi yi

∆ = 11×92.48−11.0×65.848.4 = 6.06 cm/V = kC

From spread of measurements, find uncertainty on y, A, and B:

σy ="

(yi−A−Bxi)2

N−2 = 0.14 cm = σD

σA = σy

"

x2i

∆ = 0.14 ×"

15.448.4 = 0.08 cm

σB = σy

"

N∆ = 0.14 ×

"

1148.4 = 0.07 cm/V

Calibration constant kC:kC = (6.06±0.07) cm/V

February 7, 2006 Physics 2150 Lecture 4 – p. 6