a review of error analysishomepages.rpi.edu/~danony/neep/erroranalysis.pdfaverage and variance...

22
A REVIEW OF ERROR ANALYSIS A REVIEW OF ERROR ANALYSIS NEEP Laboratory ENVE-4860 / MANE-4370 Updated 2006

Upload: others

Post on 03-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

A REVIEW OF ERROR ANALYSISA REVIEW OF ERROR ANALYSIS

NEEP LaboratoryENVE-4860 / MANE-4370

Updated 2006

Page 2: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Error Analysis

• In the laboratory we measure physical quantities.• All measurements are subject to some

uncertainties.• Error analysis is the study and evaluation of these

uncertainties.• When mathematically manipulating measured

quantities, a proper manipulation is required for the uncertainties.

2

Page 3: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Errors in Measurements

3

• Measure length with ruler.• Measure voltage with digital multimeter.• Measure time.• Measure radiation decay (counting statistics).• Stated instrumentation accuracy.• Counting ??

Page 4: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Types of Uncertainties• RANDOM – arising from a random effect.

– Example: radioactive nuclear decay.

• SYSTEMATIC – arising from a systematic effect.– Example: instrument calibration error.

Random: SmallSystematic: Small

Random: SmallSystematic: Large

Random: LargeSystematic: Small

Random: LargeSystematic: Large

Examples

4

Page 5: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

• (Measured value of x)=x ± δx– Example V=2.5±0.2

• Round error to one significant digit.– g=9.82±0.02385 m/s2 g=9.82±0.02 m/s2

• The last significant digit of the quantity should be of the same order of the uncertainty.– I=4.35±0.2 A I=4.4±0.2 A

Reporting Uncertainties

5

Page 6: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Average and Variance• Given N measurements of a quantity xi, we can estimate the mean of the

distribution of x by calculating the average:

• The estimate for the variance of the distribution is:

• The estimated standard deviation is σ.• The more samples we have (larger N), the average will get closer to the real

average of the distribution.

∑=

=N

iix

Nx

1

1

∑=

−−

=N

ii xx

N 1

22 )(1

xX

6

Page 7: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Different measurements• 4 laboratories measured the absorption cross

section of the same isotope.• Which value should I use ?

1 2 3 41060

1080

1100

1120

1140

1160

1180

1200

1220

1240

1260

1280

Cor

ss s

ectio

ns [b

arns

]

Laboratory7

Page 8: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Weighted Average• When we measure the quantity xi with an associated error σi, then the

best estimate of the of that quantity is calculated by the weighted average:

• Where the weight is taken as • The error in that estimated average is be given by:

• This calculation gives more weight to measurements with small errors.

=

== N

ii

N

iii

w

w

xwx

1

1

2

1

iiw

σ=

∑=

=N

ii

w

w1

8

Page 9: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

9

Average and Variance - ExampleORIGIN 1:=

Following are results of the same measurement from several students

x

13

12

16

11.5

⎛⎜⎜⎜⎜⎝

⎞⎟⎟

:= σ

0.5

0.4

2

0.3

⎛⎜⎜⎜⎜⎝

⎞⎟⎟

:= N length x( ):=

Non Weighted

xav1N

1

N

i

xi∑=

⋅:= xav 13.125= std1N

1

4

i

xi xav−( )2∑=

⋅:= std 1.746=

Weighted

i 1 N..:= wi1

σi( )2:=

xwav1

N

i

wi xi⋅( )∑=

1

N

i

wi∑=

:= xwav 11.974= σwav1

1

N

i

wi∑=

:= σwav 0.215=

10

12

14

16

18

20

xi

x σ+( )i

x σ−( )i

xav

xwav

i

Page 10: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Measurement Distribution I• In most cases the distribution of a measured quantity is Gaussian (or

Normal when ).

• Where µ is the average and σ is the standard deviation.

2

21

21),,(

⎟⎠⎞

⎜⎝⎛ −

−= σ

µ

πσσµ

x

exG

x=σ

10

∫∞

∞−= xdxxG ),,( σµµ dxxGx ),,()(

22 σµµσ ∫

∞−−=

-0.8 -0.6 -0.4 -0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.20

1

2

3

4

µ=0.5σ=0.25

µ=0σ=0.125

G(x

,µ,σ

)

x

•If x is sampled from a Normal distribution then•68% of the samples will be between µ-σ to µ+σ.•95.5% between µ-2σ to µ+2σ.•99.7% between µ-3σ to µ+3σ.

Page 11: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

11

• Consider a function q(xi,yi) I=1,…N.• The first order Taylor series expansion of q(xi,yi) at the point

• We can calculate the mean of q(xi,yi) :

• Which can be written as:

• From the definition of the average and thus

Error Propagation I

),( yx

)()(),(),(,,

yyyqxx

xqyxqyxqq i

yxi

yxiii −

∂∂

+−∂∂

+≈=

),( yxqq =

∑∑== ⎥

⎥⎦

⎢⎢⎣

⎡−

∂∂

+−∂∂

+≈=N

ii

yxi

yx

N

ii yy

yqxx

xqyxq

Nq

Nq

1 ,,1)()(),(11

0)( ,0)(11

=−=− ∑∑==

N

ii

N

ii yyxx

∑ ∑ ∑∑= = ==

−∂∂

+−∂∂

+≈=N

i

N

i

N

ii

yxi

yx

N

ii yy

Nyqxx

Nxqyxq

Nq

Nq

1 1 1,,1

)(1)(1),(11

⇒== ∑∑==

1),(),(111

N

i

N

i Nyxqyxq

Nq

Page 12: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Error Propagation II

12

• The variance of q is defined as :• Evaluating the variance we get:

We define the covariance:

• And finally the standard deviation σq is given by:

∑∑∑

=

===

−−∂∂

∂∂

+

−⎟⎟⎠

⎞⎜⎜⎝

⎛∂∂

+−⎟⎠⎞

⎜⎝⎛

∂∂

=⎥⎦

⎤⎢⎣

⎡−

∂∂

+−∂∂

=

N

iii

N

ii

N

ii

N

iiiq

yyxxNy

qxq

yyNy

qxxNx

qyyyqxx

xq

N

1

2

1

22

1

22

1

2

))((12

)(1)(1)()(1σ

∑=

−−=N

iiixy yyxx

N 1))((1σ

xyq yq

xq

yq

xq

yxσσσσ

∂∂

∂∂

+⎟⎟⎠

⎞⎜⎜⎝

⎛∂∂

+⎟⎠⎞

⎜⎝⎛

∂∂

= 222

22

2

∑=

−=N

iiq qq

N 1

22 )(1σ

Page 13: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Error Propagation – Examples I• In many cases we can assume that the variables are independent. For a

function with n variables q(x1,x2,….xn) the variance is given by:

• Using this equation, we can derive simple helpful relations for the propagation of errors:

• Addition and subtraction:

• Multiplication by a constant:

• Multiplication or division:

22 1yu 1 yxu

xuyxu ∆+∆=∆⇒=

∂∂

=∂∂

±=

xAuAxuAxu ∆=∆⇒=

∂∂

=

222

or ⎟⎟⎠

⎞⎜⎜⎝

⎛ ∆+⎟

⎠⎞

⎜⎝⎛ ∆

=⎟⎠⎞

⎜⎝⎛ ∆

==yy

xx

uu

yxuxyu

∑=

⎟⎟⎠

⎞⎜⎜⎝

⎛∂∂

=n

ii

iq x

q1

22

2 σσ

13

Page 14: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Error Propagation – Example II• we measured V=1.51±0.02 V across a resistor with R=900±5 Ω What

is the current I.

• Use the error propagation for division, the fractional error of I is:

• The error in I is then

• We report: I=1.68±0.02 mA.

A 1067778.1900

51.1 3−×===RVI

01436.051.102.0

9005 2222

=⎟⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛=⎟

⎠⎞

⎜⎝⎛ ∆

+⎟⎠⎞

⎜⎝⎛ ∆

=∆

VV

RR

II

A 10024.01067778.101436.0 33 −− ×=××=∆

=∆IIII

14

Page 15: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Covariance• A covariance value that is different from zero indicates that data are

correlated. Here is an example.

15σz2 8.085=σz1 6.112=

σz2 σx2

σy2

+ 2 σxy⋅+:=σz1 σx2

σy2

+:=

w ith covariancew ithout covariance

zav 124.8=zav xav yav+:=

Assume w e w ant to f ind the average sum <z>=<x>+<y>

i 1 N..:=

20 25 30 35 4090

100

yi

xi

σxy 14=σxy1N

1

N

i

xi xav−( ) yi yav−( )∑=

⋅:=

σy 2.993=σy var y( ):=σx 5.329=σx var x( ):=

yav 95.8=yav mean y( ):=xav 29=xav mean x( ):=

N length x( ):=y

93

96

100

98

92

⎛⎜⎜⎜⎜⎜⎝

⎟⎟⎟

:=x

25

34

35

30

21

⎛⎜⎜⎜⎜⎜⎝

⎟⎟⎟

:=

ORIGIN 1:=

∑=

−−=N

iiixy yyxx

N 1))((1σ

Page 16: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Counting Statistics I• For a process with very small success probability p<<1, if we carry n

experiments, the distribution having x successes is Binomial. It can be approximated by the Poisson distribution.

• The average and variance of this distribution is pn.• In nuclear decay, large number of nuclei make up a sample or numbers

of tries (n) but only a relatively small fraction of them give rise to a success event (small p).

• In a counting experiment we record the number of counts, n in a given counting time t. The distribution of n is Poisson:

• Where N is the expected counts (the mean) and the error in N is

!)()(x

epnxppnx −

=

!)(

neNnp

Nn −

=

N=σ

16

Page 17: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Counting Statistics II

0 2 4 6 8 10 12 14 16 18 200.00

0.05

0.10

0.15

0.20

0.25

0.30

P(N

,n)

n

N=2 N=3 N=4 N=5 N=6 N=7 N=8 N=9 N=10

• For large N the Poisson distribution can be approximated by the Gaussian distribution.

• Example : we make N experiment and record xi counts in each. What is the average number of counts and expected error of the average?

∑=

=N

iix

Nx

1

1

NxXN

Nx

Nx

N

N

ii

N

ii ==== ∑∑

==

11)(111

2σ 17

Page 18: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Modeling of Data-I• In many cases we have some theoretical background on the physical

behavior of the phenomena we are measuring.• In these cases we can try to check if the experiment agrees with the

theory and also extract parameters from it.• For example we would like to measure the attenuation of gamma rays

through a slab of Al. We setup the following experiment:

Thickness x

SourceDetector

Collimator Collimator

AlPb Pb

• We repeat the experiment N times (N>3) for several thickness xi of Aluminum

• We have no background (or corrected for it).18

Page 19: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Modeling of Data-II• If we count for sufficient time we except:

• Where Ci are the counts for sample i, µ is the attenuation coefficient in units of cm-1 and xi is the sample thickness.

• We take the log of both sides of the the equation we get:

• Define• The equation can be rewritten as:

• Find a procedure that can use all our measurements of yi to find a and b that best fit the data.

• Knowing the counting error in Ci, we will try to estimate the error in aand b.

ixi eIC µ−= 0

ii xIC µ−= )log()log( 0

)log( -b )log( 0IaCy ii === µ

abxy ii +=

19

Page 20: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Least-Squares Fitting I

20

• Given a series of N measurement of xi and yi ± σi., Fit the model yi=a+bxi to the data.

• We would like find a and b that will minimize the expression.

• To do that we take the first derivative with respect to a and b and set the derivatives equal to zero:

• We can define:

∑=

−−=

N

i i

iii xbay1

22 )(σ

χ

02

02

1

2

1

2

=−−

−=∂

=−−

−=∂

=

=

N

ii

i

ii

N

i i

ii

xbxayb

bxaya

σχ

σχ

∑ ∑

∑∑∑

= =

===

≡≡

≡≡≡

N

i

N

i i

iixy

i

ixx

N

i i

iy

N

i i

ix

N

i i

yxSxS

ySxSS

1 122

2

12

12

12

1

σσ

σσσ

Page 21: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

21

Least-Squares Fitting II• We can then rewrite the equations as:

• We solve the equations for a and b:

• The error in a and b can be estimated by propagating the errors in the above equations (independent case) , the result is:

xyxxx

yx

SbSaSSbSaS=+

=+

2)(

xxx

yxxyxyxyxx

SSS

SSSSb

SSSSa

−=∆∆

−=

−=

=∆

=SS

bxx

a σσ

Page 22: A REVIEW OF ERROR ANALYSIShomepages.rpi.edu/~danony/NEEP/ErrorAnalysis.pdfAverage and Variance •Given N measurements of a quantity xi, we can estimate the mean of the distribution

Least-Squares Fitting - Example

0 2 4 6 8 101

10

100

1 .103

y1i σ1i−

y1i σ1i+

Ij

xi xi, xxj,

Ij I0 exp µ− xxj⋅( )⋅:=xxj 0.1 j⋅:=j 1 100..:=

σI0 78=I0 1041=σµ 0.02=µ 0.44=

σI0 exp a( ) σa⋅:=I0 exp a( ):=σµ σb:=µ b−:=

Transforming the results of the fit

σbS∆

:=σaSxx∆

:=bS Sxy⋅ Sx Sy⋅−

∆:=

x

2

4

6

8

10

⎛⎜⎜⎜⎜⎜⎝

⎟⎟⎟

= y1

431.219

184.518

81.06

31.792

9.71

⎛⎜⎜⎜⎜⎜⎝

⎟⎟⎟

= σ1 y1:= N length x( ):=

Transform the data

xyyxIy µµ −=⇒−= )ln()ln()exp( :Remember 00y ln y1( ):=

σσ1y1

→⎯

:=

Fit the data

S1

N

i

1

σi( )2∑=

:= Sx1

N

i

xi

σi( )2∑=

:= Sy1

N

i

yi

σi( )2∑=

:= Sxx1

N

i

xi( )2

σi( )2∑=

:= Sxy1

N

i

xi yi⋅

σi( )2∑=

:=

∆ S Sxx⋅ Sx2−:= aSxxSy⋅ Sx Sxy⋅−

∆:=

22