Error Analysis: Rejection of Data, Propagation of Error, Weighting

advertisement
Error Analysis: Rejection of
Data, Propagation of Error,
Weighting Data, and Bootstrap
Some Definitions
Variance in the measurement:
1 N
2
 
(y  y)2 for N measurements of y

N  1 i1
less conservatively, use N, only, in denominator
Variance in the fit:
1 N
2
 
(y obs  ycalc )2 for N observations of y

N  1 i1
more conservatively, use N,only, in denominator
Standard Deviation for a single measurement :
var iance  
more conservatively, use N-1 in denominator
Standard Deviation of the Mean (aka Standard
Error) for many measurements of the same quantity:

(uncertainty in the average
N
value whereas  represents the uncertainty of a
single value).
Standard Error =
Rejection of Data
You make a series of measurements and one seems
to be an outlier. On what criteria can you remove the
datum?
To use Chauvenet’s Criterion we generally we reject
the datum if the probability that the datum is bad is
more than 1/2. To do this find the ratio of the
deviation of the bad datum point from the average
divided by the standard deviation of all values.
ratio 
ysuspect  y

Use a standard normal probability table and
determine if the probability of finding a value ratio
standard deviations from the mean is less than 1/2. If
it is, reject the data.
This is best seen by example (from “An Introduction to
Error Analysis” 2nd Edition, by John Taylor, University
Science Books, page 168).
Ten measurements of a quantity yield the following results: 46,48,44,
38, 45, 47, 58, 44, 45, 43
Is the value of 58 an outlier? Using all ten values
 = 5.1 with an average of 45.8
Now compute the tsus for the suspect data point
t sus 
xsus  x
x

58  45.8
 2.4
5.1
The Probability of a value lying 2.4 from the mean is 0.016.
Therefore, in a population of 10 measurements, the probability that
one of those will lie 2.4 from the mean is 10 x 0.016=0.16. This is
less than 0.5 and we can reject this data point as improbable based
on Chauvenet’s criterion.
Weighting of Data
In a typical kinetic run using spectrophotometric,
NMR, gas-uptake, or GC detection we usually expect
the variance of the measurement at each time point to
be the same. In contrast, when we measure rate
constants over a wide range of temperatures we do
NOT commonly expect (or find) the variance in the
rate constants at each temperature to be the same.
The former situation indicates that all data points
should contribute equally to the fit but the latter calls
for weighting of the data.
In a weighted least-squares fit or a weighted mean,
the weight of each data point is inversely proportional
to its variance. The variance commonly is evaluated
as the variance in the fit for the runs that produced the
parameters being fit or averaged.
Weighted Mean:
N
w 
 wiyi
i1
N
 wi
where wi 
1
 i2
i1
Weighted SSD for a Least Squares Fit:
N
SSDw  
i1
Nwi (yiobs  yicalc )2
N
 wi
where wi 
1
 i2
i1
N.B., The term in the summation corresponds to
a normalized, weighted deviation. We can
formulate a reduced weighted sum of square
deviations (SSDw ) by dividing by
the degrees of freedom (N- k, where k is the number
of parameters being fit).
SSDw
SSDw 
Nk
The reduced SSD is the general counterpart to
variances which use N-1 in the denominator.
The simplest example of using weights is simply to
take a weighted average.
Weighted Averages:
N
var iance in the average      wi
2
i1
st. dev. in the average =
 2
Error Propagation
The analysis of errors when one weights the data can
get complicated. Here we develop equations with and
without weights.
In a kinetics experiment i measurements of
absorbance and time are made. The computed (calci)
absorbances are a function of three parameters and
time.
calc t  abs   (abs0  abs )ekt
the uncertainty in the observed absorbances are
estimated by :
 abs
N
1
kt 2

(abs t  abs  (abs 0  abs )e )

N  3 i1
where the denominator represents the reduce degrees
of freedom associated with 3 fitting parameters.
Now we need to apply the general error propagation
formula:
q
 q  (  x )2 
x
q
 z )2
z
(
where x,...,z are measured with uncertainties
 x ,..., z and q is determined from the measured
values.
The problem is that to apply the error propagation
formula we need to write expressions for the fitted
parameters in terms of the measured values. There
is no simple analytical expression which means that
we must resort to numerical differentiation. Both the
Mathcad document on error estimation and the Excel
Solvstat.xls macro form a covariance matrix
numerically. Inversion of the covariance matrix yields
the error matrix with elements ij. The estimated error
in the least-squares fit parameters are given by
 j   2abs  jj
where  abs
1 N

(abs t  abs  (abs0  abs )ekt )2

N  3 i1
For the case of weighted linear least squares fit we
define the function to be minimized as:
N
Nwi (yiobs  yicalc )2
1
SSD  
where
w

i
N
2
i1
 wi
i1
i
and now the uncertainty in the weighted data
becomes:
1 N Nwi (yiobs  yicalc )2
1
 abs 
where
w


i
N
N  3 i1
 i2
 wi
i1
errors we use the same procedure but substitute in
the weighted variances for the observed data.
For an example of a weighted least-squares analysis
see the Exel datasheet 07WtFit_SolStat.xls.
Bootstrapping with Residuals
So far the analysis of uncertainties that we have used
makes two assumptions:
1) the uncertainties of observed data at each time
point are normally distributed
2) the deviations between experiment and
computed values give a good estimate of the
distribution of uncertainties in the observations.
We can eliminate the first assumption by using a
Bootstrap technique (more generally referred to
resampling of the data). An added benefit of this
approach is that we are freed from needing to form a
covariance matrix and invert it to estimate the
uncertainty in the parameters.
In the Bootstrap procedure we will create a pool of
residuals by first making a non-linear least square,
three parameter fit of the absorbance vs. time
problem and then calculating the set of differences
between observed and calculated data point. Using
our best-fit parameters we then create a set of
pseudo-data by adding a randomly chosen residual
from the pool to each of the calculated absorbances.
We then repeat this procedure many times to create a
set of 1000 pseudo-data sets. Each of these data
sets is fit by non-linear least square fitting of the three
parameters and the results (the SSD and the values
of the three parameters) are recorded. When this is
finished, we will have a distribution of the three
parameters. The shape of the distribution is guided
only by the data: it may be normal, biased, or
skewed. Usually one takes the distribution of
parameters and SSD values and sorts these by SSD
values. After sorted we can analyze the first 68%
elements for the lowest and highest values of each
parameter. These represent the upper and lower
confidence intervals for each of the parameters. Note
that these need not be symmetric. Generally we
would report the median value and the 68% or 95%
confidence intervals.
See Excel datasheet 07WtFit_Bootstrap.xls for an
example of this approach.
Download