Experimental Errors and Error Analysis Experimental Errors and

Experimental
Experimental Errors
Errors and
and Error
Error
Analysis
Analysis
Rajeev Prabhakar
University of Texas at Austin, Austin, TX
Freeman Research Group Meeting
March 10, 2004
Topics covered
• Types of experimental errors
• Reducing errors
• Describing errors quantitatively
– Measured variables
– Quantities calculated from measured variables (error
propagation)
• Least-squares fit
– straight line
– polynomial
– arbitrary function
Ref: Bevington and Robinson, Data Reduction and Error Analysis for the
Physical Sciences, 2nd edition, McGraw Hill, NY 1992
Quality of Experiments and Experimental Error
• Accuracy
– Measure of correctness of result
• Precision
– Measure of reproducibility of result
• Types of errors
– Mistakes
• Wrong membrane used
• Number recorded incorrectly, 1.92 written as 1.29
– Systematic error
• Change in membrane casting conditions
• Incorrect calibration
– Random error
• Fluctuations in temperature, pressure etc.
Reducing Errors
• Planning experiments carefully
– Objective is to understand and reduce sources of
systematic error
– Don’t give in to the “it’s always been done this
way” mentality
• Use more accurate instruments
• Repeat the measurement, if possible
Uncertainties in Measured Variables
• Fluctuations
– Often independent of actual value
• Reading an analog instrument
– ½ of smallest scale division/least count
• Uncertainty estimate – standard deviation, σ
– ½ of least count
– Repeat measurement if possible and take
standard deviation of the data
Parameters calculated from measured variables
• Propagation of Errors
– e.g. Volume measurement
Vo = LoWo H o
If the measured values are L, W and H ,
 ∂V 
 ∂V 
 ∂V 
V ( L,W , H ) Vo + ∆L 
+ ∆W 

 + ∆H 

 ∂L WoHo
 ∂W  LoHo
 ∂H  LoWo
Error , ∆V = V − Vo
2
2
N
N




1
1
2
Variance, σ V =  ∑ (Vi − Vo )  = lim
Vi − V 
∑
N →∞ 
 N i =1

 N i =1

(
)
Propagation of errors – general formula
y = f (u , v)
 ∂y 
 ∂y 
yi − y = (ui − u )   + (vi − v)  
 ∂u 
 ∂v 
2
N


1
σ y2 = lim
y
−
y
∑
i

N →∞ 
N
1
i
=


(
)
2
2


1
y
y
∂
∂

 ∂y   ∂y  




2
2
2
σ y = lim
 ∑ (ui − u )   + ∑ (vi − v)   + ∑ 2(ui − u )(vi − v)     
N →∞
 ∂u 
 ∂v 
 ∂u   ∂v  
 N 
2
2
 ∂y 
 ∂y 
 ∂y   ∂y 
σ y2 = σ u2   + σ v2   + 2σ uv2    
 ∂u 
 ∂v 
 ∂u   ∂v 
(1)
co-variance
Neglecting the co - variance,
2
 ∂y 
 ∂y 
σ y2 σ u2   + σ v2  
 ∂u 
 ∂v 
2
(2)
Volume example – simplified equation
2
 ∂y 
2  ∂y 
σ σ   +σv  
 ∂u 
 ∂v 
2
y
2
2
u
2
2
2
2  ∂V 
2  ∂V 
2  ∂V 
σV σ L 
 + σW 
 +σH 

L
W
H
∂
∂
∂






Since V = LWH ,
σ σ (WH ) + σ
2
V
2
2
L
2
2
W
( HL ) + σ ( LW )
2
2
H
2
V 
2  V 
2  V 
σ σ   + σW   + σ H  
L
W 
H
2
V
2
2
2
2
L
2
2
2
 σV   σ L   σW   σ H 
 V   L  + W  + H 
    
 

2
Simplified form of equation valid when the dependent variable is a
product of independent variables to the 1 or -1 power only
Example - Limitations of simplified equation
If V = π R 2 H ,
2
 ∂V 
2  ∂V 
σ σ 
 +σH 

 ∂R 
 ∂H 
2
V
2
R
σ σ ( 2π RH ) + σ
2
V
2
2
2
R
2
H
(π R )
2
2
 2V 
2  V 
σ σ   +σH  
 R 
H
2
V
2
2
R
2
2
 σ V   2σ R   σ H 
 V   R  + H 
  
 

2
2
Least-squares fit to a straight line
• y = a + b*x
• Objective is to find the values of a and b that provide the
best prediction of y for a given x
2
χ
• Goodness-of-fit parameter,
1
2
2
χ = ∑  2 ( yi − a − bxi ) 
σ i

(3)
To minimize the error,
∂χ 2
∂χ 2
=0=
∂a
∂b
• Resulting equations for a and b – pgs. 104 and 113 of
Bevington
• Errors in a and b - Equations on pgs. 109 & 114 of Bevington
Least-squares fit to an equation linear in the
coefficients
• Example,
Polynomial: y = a + b*x + c*x2 + …..
Other functions: y = a + b*ex
• Similar mathematical treatment as for straight line. However,
determinants get bigger and more numerous. See pg 117
(last 3 lines) and 118 for example of quadratic equation.
• Alternate method – Matrix solution (pg. 121)
Matrix Method for equation linear in coefficients
m
y ( xi ) = ∑ ak f k ( xi )
k =1
The coefficient matrix a is given by,
a = βα −1
where
1

β k = ∑  2 yi f k ( xi )  ; row matrix
σ i

1

α lk = ∑  2 f l ( xi ) f k ( xi )  ; symmetric matrix
σ i

Error in the coefficients are elements of the inverse α matrix
- Diagonal elements are variances
σ a2k = α kk−1
- Off-diagonal elements are co-variances
σ a2l ak = α lk−1
Example – Quadratic fit to Permeability data
P = b + c ∆p + d ( ∆ p ) 2
Compare with,
m
y ( xi ) = ∑ ak f k ( xi ) = a1 f1 ( xi ) + a2 f 2 ( xi ) + a3 f 3 ( xi )
k =1
Therefore,
a1 = b; a2 = c; a3 = d ;
f1 = 1;
f 2 = ∆p;
f 3 = ( ∆p ) 2
Solve for a, b and c using matrix method
You will also obtain variances and covariances (previous slide)
Then, calculate error in P using eqs. (1) or (2).
Example in Excel file: Error analysis demo.xls; sheet: P
For more details, including an example, Bevington: pgs. 121-125
Least-squares fit to any function
• Best-fit for functions that are not linear in the coefficients
• Trial-and-error methods (Ch. 8, Bevington)
• Find coefficient values by using SOLVER function in Excel
•
2
χ
To get errors, vary one coefficient at a time to increase
by 1
• The change in the coefficient is it’s standard deviation
Example – S fit to dual mode equation
f *g
S =e+
1+ g * p
Determine coefficients by minimizing χ 2 ,
2
N


S
S
−


1
χ 2 =  ∑  calc exp t  
σi
 N i =1 
 
by varying the coefficients e, f and g.
Change initial guess values of the coefficients to
confirm best - fit values.
Then determine σ for each coefficient, by the
method described on the previous slide.
Example in Excel file: Error analysis demo.xls; sheet: S
Calculating Deff from best fit equations of P and S

dP   dp 
Deff (C2 ) =  P + ∆p
  dC 
∆
d
p
 p2

 p2 
b + 2c(∆p ) + 3d (∆p) 2 NUMR
=
=
fg
DENR
e+
(1 + g p ) 2
Calculate NUMR & DENR and their errors.
Calculate Deff .
 σ Deff
Error in Deff , 
D
 eff
2
  σ NUMR  2  σ DENR  2
 = 
 +

NUMR
DENR
 

 
References
Bevington
•Pgs. 1-6: Accuracy, precision and uncertainties
•Pgs. 41-48: Propagation of errors with specific examples
•Pgs. 101-114: Least-squares fit to a straight line
•Pgs. 115-125: Least-squares fit to a function linear in the
coefficients, including an example for a
quadratic fit
Microsoft Excel Help
•MINVERSE worksheet function
•MMULT worksheet function
Questions