Analytical Chemistry
NT10402
Basic Statistics and Data Handling
Jahurul Haque, PhD
Faculty of Food Science and Nutrition
Universiti Malaysia Sabah
Outline
• Introduction
• Confidence Intervals
• Statistical Aids to Hypothesis Testing
• Analysis of Variance
• Detection of Gross Errors
Introduction
• Statistical data analysis is use:
- to evaluate the quality of experimental
measurements
- To test various hypotheses
- To develop model to describe experimental
results
Application of statistical data treatment
1. To define the confidence interval.
2. To determine the number of replicate measurement
required to a certain range with a given level of probability.
3. To estimate the probability of two experimental means
are different; discovering systematic errors.
4. To determine the precision of two set of measurements
differs.
5. To compare the means of more than two samples
(analysis of variance).
6. To decide whether to reject or retain a result to be an
outliers
Confidence Interval
• With statistics, we can establish an interval
surrounding the experimentally determined
mean xwithin which the population mean μ is
expected to lie with a certain degree of
probability.
• This interval is known as the confidence
interval.
• Sometimes the limits of the interval are called
confidence limits.
• 95% confidence interval reflects a significance
level of 0.05.
Finding the Confidence Interval
When σ is Known
• The relative frequency is plotted as a function of the
quantity z, which is the deviation from the mean
divided by the population standard deviation.
• A range of values around a measurement result
within which the true mean is likely to lie with a
certain probability provided with a reasonable
estimate of σ.
• For example, if we have a result x from a data set
with a standard deviation of σ, we may assume that
90 times out of 100 the true mean μ will fall in the
interval x ± 1.64σ (see Figure 7-1c).
• The probability is called the confidence level (CL).
• In the example of Figure 7-1c, the confidence level is
90% and the confidence interval is from -1.64σ to +
1.64σ.
• The probability that a result is outside the confidence
interval is often called the significance level.
Figure 7-1
Areas
under a
Gaussian
curve for
various
values of
±z.
The confidence level is 90% and the
confidence interval is from -1.64σ to + 1.64σ.
• If we make a single measurement x from a
distribution of known σ, we can say that the true
mean should lie in the interval x ± zσ with a
probability dependent on z.
• This probability is 90% for z = 1.64, 95% for z =
1.96, and 99% for z = 2.58, as shown in Figure 7-
1c, d, and e.
Figure 7-1 Areas under a Gaussian curve for various values
of ±z.
• A general expression for the confidence
interval (CI) of the true mean based on
measuring a single value x.
• Instead, we can use the experimental mean xof
N measurements as a better estimate of μ.
• In this case, we replace x in above equation
with x and σ with the standard error of the
mean N .
• Values of z at various confidence levels are
found in Table 7-1, and the relative size of the
confidence interval as a function of N is shown
in Table 7-2.
Example:
Determine the 80% and 95% confidence intervals for (a) the
first entry (1108 mg/L glucose) and (b) the mean value
(1100.3 mg/L) for month 1. Assume that in each part, spooled
= 19 is a good estimate of s.
Time Glucose Concentration, Mean Glucose, Sum of Squares of Standard
mg/L mg/L Deviations from Mean Deviation
Month 1 1108, 1122, 1075, 1099, 1100.3 1687.43 16.8
1115, 1083, 1100
Month 2 992, 975, 1022, 1001, 991 996.2 1182.80 17.2
Month 3 788, 805, 779, 822, 800 798.8 1086.80 16.5
Month 4 799, 745, 750, 774, 777, 771.9 2950.86 22.2
800, 758
Example 1:
How many replicate measurements in month 1 are
needed to decrease the 95% confidence interval to
1100.3 ± 10.0 mg/L of glucose?
Time Glucose Concentration, Mean Glucose, Sum of Squares of Standard
mg/L mg/L Deviations from Mean Deviation
Month 1 1108, 1122, 1075, 1099, 1100.3 1687.43 16.8
1115, 1083, 1100
Month 2 992, 975, 1022, 1001, 991 996.2 1182.80 17.2
Month 3 788, 805, 779, 822, 800 798.8 1086.80 16.5
Month 4 799, 745, 750, 774, 777, 771.9 2950.86 22.2
800, 758
Finding the Confidence Interval
When σ is Unknown
• Often, limitations in time or in the amount of
available sample prevent us from making enough
measurements to assume s is a good estimate of
σ.
• In such a case, a single set of replicate
measurements must provide not only a mean but
also an estimate of precision.
• As indicated earlier, s calculated from a small set
of data may be quite uncertain. Thus, confidence
intervals are necessarily broader when we must
use a small sample value of s as our estimate of σ.
• To account for the variability of s, we use the
important statistical parameter t, which is
defined in exactly the same way as z except that
s is substituted for σ.
• For a single measurement with result x, we can
define t as,
• For the mean of N measurements,
• Like z, t depends on the desired confidence
level. However, t also depends on the number of
degrees of freedom in the calculation of s.
• Table 7-3 gives t values for a few degrees of
freedom.
• Note that t approaches z as the number of
degrees of freedom becomes large. The
confidence interval for the mean x of N replicate
measurements can be calculated from t by
following Equation, which is similar to Equation
using z:
Example 3:
A clinical chemist obtained the following data for
the alcohol content of a sample of blood: %
C2H5OH: 0.084, 0.089, and 0.079. Calculate the
95% confidence interval for the mean assuming
that (a) the three results obtained are the only
indication of the precision of the method and that
(b), from previous experience on hundreds of
samples, we know that the standard deviation of
the method s = 0.005% C2H5OH and is a good
estimate of σ.
Statistical Aids to Hypothesis Testing
• Hypothesis testing is the basis for many
decisions made in science and engineering.
• To explain an observation, a hypothetical
model is advanced and tested
experimentally to determine its validity.
• The hypothesis tests that we describe are
used to determine if the results from these
experiments support the model.
Statistical Aids to Hypothesis Testing
• If they do not support our model, we
reject the hypothesis and seek a new one.
• If agreement is found, the hypothetical
model serves as the basis for further
experiments.
• When the hypothesis is supported by
sufficient experimental data, it becomes
recognized as a useful theory until such
time as data are obtained that refute it.
• Tests of this kind use a null hypothesis, which assumes
that the numerical quantities being compared are, in
fact, the same.
• Use a probability distribution to calculate the
probability that the observed differences are a result of
random error.
• If the observed difference is greater than or equal to
the difference that would occur 5 times in 100 by
random chance (a significance level of 0.05), the null
hypothesis is considered questionable, and the
difference is judged to be significant.
• Other significance levels, such as 0.01 (1%) or 0.001
(0.1%), may also be adopted, depending on the
certainty desired in the judgment.
• The confidence level, CL, as a percentage is related to a
by CL 5 (1 - α) x 100%. A null hypothesis postulates that two
or more observed quantities are the
same.
Specific examples of hypothesis tests that
scientists often use include the
comparison of
(1)The mean of an experimental data set
with what is believed to be the true
value
(2) The mean to a predicted or cutoff
(threshold) value.
(3) The means or the standard deviations
from two or more sets of data.
Comparing an Experimental Mean with a Known Value
• There are many cases in which a scientist needs to
compare the mean of a data set with a known value.
• In all cases, we use a statistical hypothesis test to draw
conclusions about the population mean μ and its
nearness to the known value, which we call μ0.
• There are two contradictory outcomes that we consider
in any hypothesis test. The first, the null hypothesis H0,
states that μ = μ0.
• The second, the alternative hypothesis Ha can be stated
in several ways. We might reject the null hypothesis in
favor of Ha if μ is different than μ0 (μ ≠ μ0). Other
alternative hypotheses are μ > μ0 or μ < μ0.
Large Sample z Test
If a large number of results are available so that s is a good
estimate of σ, the z test is appropriate. The procedure that
is used is summarized below:
Rejection regions for the 95% confidence level. (a) Two-tailed test for Ha: μ ≠ μ0. Note the critical value of
z is 1.96. (b) One-tailed test for Ha: μ > μ0. The critical value of z is 1.64 so that 95% of the area is to the
left of zcrit and 5% of the area is to the right. (c) One-tailed test for Ha: μ < μ0. The critical value is again
1.64 so that 5% of the area lies to the left of -zcrit.
Example
A class of 30 students determined the activation energy of a
chemical reaction to be 116 kJ mol–1 (mean value) with a
standard deviation of 22 kJ mol–1. Are the data in
agreement with the literature value of 129 kJ mol–1 at (a)
the 95% confidence level and (b) the 99% confidence level?
Estimate the probability of obtaining a mean equal to the
student value.
Small Sample t Test
For a small number of results, we use a similar procedure
to the z test except that the test statistic is the t statistic.
Again we test the null hypothesis H0: μ = μ0, where μ0 is a
specific value of μ such as an accepted value, a theoretical
value, or a threshold value. The procedure is:
If the analytical method had no systematic error, or
bias, random errors would give the frequency
distribution shown by curve A. Method B has some
systematic error so that xB, which estimates μB,
differs from the accepted value μ0. The bias is given
by
Systematic errors causes
the mean of a data set to
differ from the accepted
value in which the results
to be too high or too low.
Random errors causes
Illustration of systematic error in an analytical data to be scattered more
method. Curve A is the frequency distribution for the
or less symmetrically
accepted value by a method without bias. Curve B
illustrates the frequency distribution of results by a around a mean value.
method that could have a significant bias due to a
systematic error.
Example:
A new procedure for the rapid determination of sulfur in kerosenes was tested on a
sample known from its method of preparation to contain 0.123% S (μ0 = 0.123% S). The
results for % S were 0.112, 0.118, 0.115, and 0.119. Do the data indicate that there is a
bias in the method at the 95% confidence level?
Solution:
Break time
Comparison of Two Experimental Means
• Scientists must judge whether a difference in the
means of two sets of data is real or the result of
random error.
• In some cases, the results of chemical analyses are
used to determine whether two materials are
identical.
• In other cases, the results are used to determine
whether two analytical methods give the same
values or whether two analysts using the same
methods obtain the same means.
• An extension of these procedures can be used to
analyze paired data.
• Data are often collected in pairs to eliminate one
source of variability by focusing on the differences
within each pair.
The t Test for Differences in Means
• We can test for differences in means with the z test,
modified to take into account a comparison of two sets of
data, if we have large numbers of measurements in both
data sets.
• More often, both sets contain only a few results, and we
must use the t test.
• The test statistic is then compared with the critical value of
t obtained from the table for the particular confidence
level desired.
• If the absolute value of the test statistic is less than the
critical value, the null hypothesis is accepted, and no
significant difference between the means has been
demonstrated.
• A test value of t greater than the critical value indicates a
significant difference between the means.
Example:
In a forensic investigation, a glass containing red wine and an open bottle were
analyzed for their alcohol content in order to determine whether the wine in
the glass came from the bottle. On the basis of six analyses, the average
content of the wine from the glass was established to be 12.61% ethanol. Four
analyses of the wine from the bottle gave a mean of 12.53% alcohol. The 10
analyses yielded a pooled standard deviation spooled = 0.070%. Do the data
indicate a difference between the wines?
Solution:
Paired Data
• Scientists make use of pairs of measurements on
the same sample in order to minimize sources of
variability.
• The paired t test uses the same type of procedure
as the normal t test except that we analyze pairs
of data and compute the differences, di. The
standard deviation is now the standard deviation
of the mean difference. Our null hypothesis is H0:
μd = Δ0, where Δ0 is a specific value of the
difference to be tested, often zero. The test
statistic value is
Example:
Errors in Hypothesis Testing
• The choice of a rejection region for the null
hypothesis is made so that we can readily
understand the errors involved.
• At the 95% confidence level, for example, there is
a 5% chance that we will reject the null hypothesis
even though it is true.
• This could happen if an unusual result occurred
that put our test statistic z or t into the rejection
region. The error that results from rejecting H0
when it is true is called a type I error.
• The other type of error is that we accept H0 when
it is false. This is termed a type II error. The
probability of a type II error is given the symbol β.
Comparison of Variances
• At times, there is a need to compare the variances
(or standard deviations) of two data sets.
• A simple statistical test, called the F test, can be
used to test this assumption under the provision
that the populations follow the normal (Gaussian)
distribution.
• The F test is also used in comparing more than
two means and in linear regression analysis.
Example:
A standard method for the determination of the carbon monoxide (CO) level in gaseous
mixtures is known from many hundreds of measurements to have a standard deviation of
0.21 ppm CO. A modification of the method yields a value for s of 0.15 ppm CO for a
pooled data set with 12 degrees of freedom. A second modification, also based on 12
degrees of freedom, has a standard deviation of 0.12 ppm CO. Is either modification
significantly more precise than the original
Solution:
Analysis of Variance (ANOVA)
• These methods use a single test to
determine whether there is or is not a
difference among the population means
rather than pairwise comparisons as is
done with the t test.
• After ANOVA indicates a potential
difference, multiple comparison
procedures can be used to identify which
specific population means differ from the
others.
• Experimental design methods take
advantage of ANOVA in planning and
performing experiments.
ANOVA Concepts
In ANOVA procedures, we detect difference in
several population means by comparing the
variances. For comparing I population means,
μ1, μ2, μ3,…μI .The null hypothesis H0 is of the
form
H0: μ1 = μ2 = μ3 = … = μI
and the alternative hypothesis Ha is
Ha: at least two of the μi’s are different.
ANOVA Concepts
The following are typical applications of ANOVA:
1. Is there a difference in the results of five analysts
determining calcium by a volumetric method?
2. Will four different solvent compositions have
differing influences on the yield of a chemical
synthesis?
3. Are the results of manganese determinations by
three different analytical methods different?
4. Is there any difference in the fluorescence of a
complex ion at six different values of pH?
In each of these situations, the populations have
differing values of a common characteristic called a
factor or sometimes a treatment. In the case of
determining calcium by a volumetric method, the
factor of interest is the analyst. The different values of
the factor of interest are called levels.
• The type of ANOVA is known as a single-
factor, or one-way, ANOVA.
• Several factors may be involved. In such a
case, the type of ANOVA is known as a two-
way ANOVA.
• In ANOVA, the factor levels are often called
groups.
• The basic principle of ANOVA is to compare
the between-groups variation to the within-
groups variation.
• In our specific case, the groups (factor levels)
are the different analysts, and this case is a
comparison of the variation between analysts
to the within-analyst variation.
Single Factor ANOVA
• Several quantitites are important for testing the
null hypothesis H0 : μ1 = μ2 = μ3 = … = μI .
• The grand mean can be calculated as the weighted
average of the individual group means
• where N1 is the number of measurements in group
1, N2 is the number in group 2, and so on.
• The grand average can also be found by summing
all the data values and dividing by the total
number of measurements N.
• To calculate the variance ratio needed in the F test,
it is necessary to obtain several other quantities
called sums of squares:
Single Factor ANOVA
1. The sum of the squares due to the factor SSF
2. The sum of the squares due to error SSE
3. The total sum of the squares SST is obtained
as the sum of SSF and SSE.
4. The number of degrees of freedom for each of
the sum of squares must be obtained. The total
sum of the squares SST has N - 1 degrees of
freedom. Just as SST is the sum of SSF and SSE.
5. By dividing the sums of squares by their
corresponding degrees of freedom, we can
obtain quantities that are estimates of the
between-groups and within-groups variations.
These quantities are called mean square values
Single Factor ANOVA
It is common practice to summarize the
results of ANOVA in an ANOVA table, as
follows:
Example
Determining which Results Differ
• If significant differences are indicated in ANOVA,
we are often interested in the cause. There are
several methods to determine which means are
significantly different. One of the simplest is the
least significant difference method.
• The least significant difference LSD is calculated as
follows:
where MSE is the mean square for error and the
value of t has N – I degrees of freedom
Example:
For the above example, determine which analysts
differ from each other at the 95% confidence level.
The Q Test
• The Q test is a simple, widely used statistical test
for deciding whether a suspected result should be
retained or rejected.
• In this test, the absolute value of the difference
between the questionable result xq and its
nearest neighbor xn is divided by the spread w of
the entire set to give the quantity Q:
Example:
The analysis of a city drinking water for arsenic
yielded values of 5.60. 5.64, 5.70, 5.69, and 5.81
ppm. The last value appears anomalous; should it be
rejected at the 95% confidence level?
Solution:
Thank You