Post on 03-Dec-2014
Statistics
Models, Errors, Statistical Analysis, Experimental Design and Optimisation
N.J. Goddard
CHEN10011 Engineering Maths - Statistics 2
Recommended Reading• Statistics and Chemometrics for Analytical Chemistry, 6th
Edition, J.N. Miller and J.C. Miller, Prentice-Hall, ISBN 0273730428
• Chemometrics: Statistics and Computer Applications in Analytical Chemistry, M. Otto, Wiley-VCH, ISBN 3527314180
• Statistical Procedures for Analysis of Environmental Monitoring Data and Risk Assessment, E.A. McBean and F.A. Rovers, Prentice-Hall, ISBN 0136750184.
• Statistical Tables, J. Murdoch and J.A. Barnes, 4th Edition, McMillan, ISBN 0333558596
CHEN10011 Engineering Maths - Statistics 3
Also see:
• http://www.itl.nist.gov/div898/handbook/index.htm• This is a very comprehensive on-line handbook of
statistics with examples
CHEN10011 Engineering Maths - Statistics 4
Classification of Data• Two types of variable:• Discrete: also known as step variables
– can be counted– described by a fixed set of values– each value of the variable can be associated with an integer index
• Continuous– continuous range of values– dependent upon the precision of the measurement or the accuracy of
the observer
CHEN10011 Engineering Maths - Statistics 5
Classification of Errors• Two types of error:• Systematic: also known as determinate errors
– built into the observation– affect the accuracy of measurement– caused by imperfections in the instruments– may be quantified and corrected for
• Random: also known as indeterminate errors– due to random and uncontrolled variations– affect the precision of the observation
• Statistical methods may be used to assess the effect of a random or indeterminate error.
CHEN10011 Engineering Maths - Statistics 6
An example of a source of systematic error in a measurement
• How can we remove the systematic error?
V
Power SupplyTransducer
Stimulus
Copper AluminiumT
CHEN10011 Engineering Maths - Statistics 7
Summarising Data• We need single numbers that summarise large
data sets• We need a measure of central tendency – a
“middle” value of the data• We also need a measure of dispersion – how
widely spread the data are from the central value
CHEN10011 Engineering Maths - Statistics 8
Summarising Data – Central Tendency• The Mean• The mean is defined by:
– is the sample mean– xi is a member of the sample– n is the size of the sample
• Also referred to as the first moment of a sample
xx
n
ii
n
1
x
CHEN10011 Engineering Maths - Statistics 9
Summarising Data – Central Tendency
• The mean is not a robust measure of central tendency
• Outliers pull the mean away from the “true” central value
CHEN10011 Engineering Maths - Statistics 10
Summarising Data – Central Tendency
• The Mode– Is the value of the most frequent observation in a set
of data– May be evaluated using graphical techniques– There may not be a unique value of the mode– Data may be bimodal, trimodal etc– Is also not very robust
CHEN10011 Engineering Maths - Statistics 11
Summarising Data – Central Tendency• The Mode
x
-4 -2 0 2 4
Fre
quen
cy
0.00
0.05
0.10
0.15
0.20
0.25
x
-4 -2 0 2 4
Fre
quen
cy
0.00
0.02
0.04
0.06
0.08
0.10
0.12
0.14
0.16
Bimodal Trimodal
CHEN10011 Engineering Maths - Statistics 12
Summarising Data – Central Tendency
• The Median – Is the mid-point in a sorted set of data– If the number of observations is odd:– the median is the centre value in a sorted list of
observations– Otherwise, is the average of the two observations on
either side of the centre
CHEN10011 Engineering Maths - Statistics 13
Measurements of Dispersion• The Variance (S2)• The variance of a sample is given by:
• Using the square of the difference between a sample value and the mean ensures that the variance is always positive
• Also referred to as the second moment of a sample
Sx x
n
ii
n
2
2
1
1
( )
CHEN10011 Engineering Maths - Statistics 14
Measurements of Dispersion• This equation can be re-written to make calculation easier:
• In this case, all that needs to be calculated are the sums of x and x2
• This is the preferred form for calculating the variance of a sample
Sx
x
nn
ii
n ii
n
2
2
1
1
2
1
CHEN10011 Engineering Maths - Statistics 15
Measurements of Dispersion
• Standard deviation (S)• Standard deviation is the square root of the
variance and so may be described simply by:
Sx x
n
ii
n
( )2
1
1
CHEN10011 Engineering Maths - Statistics 16
Measurements of Dispersion
• Or:
• This is the preferred form for performing calculations of standard deviation
Sx
x
nn
ii
n ii
n
2
1
1
2
1
CHEN10011 Engineering Maths - Statistics 17
Measurements of Dispersion• Relative Standard Deviation
– Ratio of the standard deviation to the mean as a percentage
• Coefficient of variation– Ratio of the standard deviation over the sample mean
RSDS
x 100%
Coefficient of VariationS
x
CHEN10011 Engineering Maths - Statistics 18
Measurements of Dispersion • Average Absolute Deviation• The average absolute deviation is defined by:
• m(X) is the measure of central tendency against which the absolute deviations are measured
• The mean, median or mode can be used
n
XmxAAD
n
ii
1
)(
CHEN10011 Engineering Maths - Statistics 19
Measurements of Dispersion • Mean Absolute Deviation (MAD)• The mean is used as the measure of central
tendency:
• For a Gaussian (normal) distribution, the MAD is about 0.8 times the standard deviation
n
xxMAD
n
ii
1
CHEN10011 Engineering Maths - Statistics 20
Measurements of Dispersion • The choice of central tendency has a significant effect on
the AAD• For the dataset 1, 1, 2, 3, 13:
Central Value Type
Central Value AAD
Mean 4 3.6
Median 2 2.8
Mode 1 3.0
CHEN10011 Engineering Maths - Statistics 21
Measurements of Dispersion • Median Absolute Deviation (MAD)• This is the median of the absolute deviations from
the median of the data:
• This is a robust measure of dispersion – that is, outliers have little effect
)(XmedianxmedianMAD i
CHEN10011 Engineering Maths - Statistics 22
Measurements of Dispersion • Median Absolute Deviation (MAD)• MAD can be used to make a robust estimate of the
population standard deviation (σ)• In this case, MAD/0.6745 is used as the estimate of
σ
CHEN10011 Engineering Maths - Statistics 23
Example 1
• 20 mass measurements were made of a flask of reagent
• The units and measurements were in grams:–12.475 12.469 12.481 12.466–12.474 12.465 12.475 12.473–12.481 12.472 12.482 12.475–12.485 12.473 12.465 12.485–12.468 12.477 12.450 12.513
CHEN10011 Engineering Maths - Statistics 24
Example 1
• Sample mean:
• Rounded to the same number of decimal places as the original data:
g
x
x ii
4752.1220
504.249
20
20
1
gx 475.12
CHEN10011 Engineering Maths - Statistics 25
Rounding• Do not forget to round properly• Do not round too soon
– Only round when presenting results• Round to the same number of decimal places as
original data• Remember the units!• Remember the units!• Remember the units!
CHEN10011 Engineering Maths - Statistics 26
Calculation of standard deviationxi
2 x xi x xi 2
Observation xi
1 12.513 156.575169 0.038 0.001444
2 12.485 155.875225 0.010 0.000100
3 12.485 155.875225 0.010 0.000100
4 12.482 155.800324 0.007 0.000049
5 12.481 155.775361 0.006 0.000036
6 12.481 155.775361 0.006 0.000036
7 12.477 155.675529 0.002 0.000004
8 12.475 155.625625 0.000 0.000000
9 12.475 155.625625 0.000 0.000000
10 12.475 155.625625 0.000 0.000000
11 12.474 155.600676 -0.001 0.000001
12 12.473 155.575729 -0.002 0.000004
13 12.473 155.575729 -0.002 0.000004
14 12.472 155.550784 -0.003 0.000009
15 12.469 155.475961 -0.006 0.000036
16 12.468 155.451024 -0.007 0.000049
17 12.466 155.401156 -0.009 0.000081
18 12.465 155.376225 -0.010 0.000100
19 12.465 155.376225 -0.010 0.000100
20 12.450 155.002500 -0.025 0.000625
Sums: 249.504 3112.615078 0.0 0.002778
CHEN10011 Engineering Maths - Statistics 27
Calculation of standard deviationx xi x xi
2
ix 3 dp 4 dp 5 dp 6 dp
1 12.513 0.038 0.001 0.0014 0.00144 0.001444
2 12.485 0.01 0 0.0001 0.00010 0.000100
3 12.485 0.01 0 0.0001 0.00010 0.000100
4 12.482 0.007 0 0 0.00004 0.000049
5 12.481 0.006 0 0 0.00003 0.000036
6 12.481 0.006 0 0 0.00003 0.000036
7 12.477 0.002 0 0 0.00000 0.000004
8 12.475 0 0 0 0.00000 0.000000
9 12.475 0 0 0 0.00000 0.000000
10 12.475 0 0 0 0.00000 0.000000
11 12.474 -0.001 0 0 0.00000 0.000001
12 12.473 -0.002 0 0 0.00000 0.000004
13 12.473 -0.002 0 0 0.00000 0.000004
14 12.472 -0.003 0 0 0.00000 0.000009
15 12.469 -0.006 0 0 0.00003 0.000036
16 12.468 -0.007 0 0 0.00004 0.000049
17 12.466 -0.009 0 0 0.00008 0.000081
18 12.465 -0.01 0 0.0001 0.00010 0.000100
19 12.465 -0.01 0 0.0001 0.00010 0.000100
20 12.45 -0.025 0 0.0006 0.00062 0.000625
Sums: 249.504 0 0.001 0.0024 0.00271 0.002778
S 0.007255 0.011239 0.011943 0.012092
CHEN10011 Engineering Maths - Statistics 28
Calculation of standard deviation (1)
• To calculate standard deviation:
232 10778.2 gxxi
24
3
20
1
2
2 10462.119
10778.2
19g
xxS i
i
S g 1462 10 0 0124. .
CHEN10011 Engineering Maths - Statistics 29
Calculation of standard deviation (2)
• Using the alternate form:
S
g
3112 615078249 504
20
19
3112 615078 3112 612301
190 012
2
..
. ..
CHEN10011 Engineering Maths - Statistics 30
RSD, Mode and Median
• Relative standard deviation:
• Mode = 12.475g (most frequent measurement)• Median:
RSDS
x 100%
0 012
12 475100% 0 096%
.
..
)(475.124745.122
474.12475.12roundedgg
CHEN10011 Engineering Maths - Statistics 31
Quick Check of Standard Deviation
• If your calculated S is greater than the span of the data (that is, the difference between the maximum and minimum value), then your S is WRONG
• Consider two observations, x1 and x2
222
2
22
2
2
122
1
122
212221
21
22
21
21
2221
212
221
2212
221
2
2
12
xxxxxxxxxxx
x
xxxxxx
xxxx
nn
xx
S
xxSpan
CHEN10011 Engineering Maths - Statistics 32
Quick Check of Standard Deviation
• In general, the maximum and minimum possible standard deviations as a function of the span of the observations are given by:– Odd number of observations:
– Even number of observations:
22
1 ,
4
1minmax
n
SpanSn
nSpanS
22
1 ,
44 minmax
nSpanS
n
nSpanS
CHEN10011 Engineering Maths - Statistics 33
Quick Check of Standard Deviation• Example:
CHEN10011 Engineering Maths - Statistics 34
Absolute Average Deviations
• From mean: 0.00776 g• From median: 0.0077 g• From mode: 0.0077 g
CHEN10011 Engineering Maths - Statistics 35
Median Absolute Deviation
• MAD = 0.0065 g• Robust estimate of population standard deviation
(σ) is MAD/0.6745• This is 0.00964 g (rounded to 3 significant figures)• Which is lower than our sample standard deviation
of 0.012 g• Is there an outlier?
CHEN10011 Engineering Maths - Statistics 36
Outlier Value (g)
12.38 12.40 12.42 12.44 12.46 12.48 12.50 12.52 12.54
Cen
tral
Val
ue (
g)
12.46
12.47
12.48
12.49
Mode
Median
Mean
Robustness of Measures• Effect of an outlier on the mean, mode and median:
• The mode is least robust and the median the most robust indicator of central tendency
CHEN10011 Engineering Maths - Statistics 37
Frequency Distributions
(a) Frequency Distribution of Observed Masses
Observed Mass (g)
12.44 12.46 12.48 12.50 12.52
Num
ber
of
Ob
serv
atio
ns
0
1
2
3
4
(b) Cumulative Frequency Distribution of Observed Masses
Observed Mass
12.44 12.46 12.48 12.50 12.52
Cum
ula
tive
Nu
mb
er o
f O
bse
rva
tion
s
0
5
10
15
20
25
CHEN10011 Engineering Maths - Statistics 38
Propagation of Errors• Most measurements are composite• That is, they are a function of two or more simple variables• Example: measurement of mass of material
• Given the errors in the simple variables, what is the error in the composite value?
vesselmaterialvesselmaterial mmm
CHEN10011 Engineering Maths - Statistics 39
Propagation of Errors• A small error ∆x in a length measurement x:
• Leads to increased errors in area estimates:
x ∆x
x ∆x
x
∆x
Error is 2xx+x2
x∆x
x∆x ∆x2
CHEN10011 Engineering Maths - Statistics 40
Propagation of Errors• And even larger errors in estimates of volume:
x ∆x
x2∆x
x∆x2
∆x3
Error is 3x2x+3xx2+x3
CHEN10011 Engineering Maths - Statistics 41
Propagation of Errors• Random errors tend to cancel each other out (consider
the drunkard’s walk)• Systematic errors are vectors which do not cancel out• Thus, the propagation of systematic and random errors
are undertaken in a slightly different ways • Consider x =a +b
– If a and b each have a systematic error of +1 then the whole systematic error of x is +2.
– If a and b have an indeterminate error of 1: – The random error in x is not 2– Sometimes a will have an error of +1 while b has an error of -1,
cancelling out.
CHEN10011 Engineering Maths - Statistics 42
Propagation of Determinate Errors• For a two factor system:
• where the uncertainty in x and z is x and z• If
• Then
y f x z ( , )
y x z .
y y x x z z xz x z z x x z ( )( )
CHEN10011 Engineering Maths - Statistics 43
Propagation of Determinate Errors• So,
• But ∆x ∆z will be small, so
• Differentiating with respect to x and z gives us:
y x z z x x z
y x z z x
xy
zx
zy
xz
CHEN10011 Engineering Maths - Statistics 44
Propagation of Determinate Errors
• So,
• for a multi-variate system:
yy
zz
y
xx
x z
y f x x xn ( , ),1 2
yy
xx
y
xx
y
xx
x xn x xn n x xn
n
1 2
12 1
2
1 1, , ,
CHEN10011 Engineering Maths - Statistics 45
Propagation of Determinate Errors
• The contribution of a determinate error in a variable to the total error is given by the magnitude of the error multiplied by the sensitivity of the derived variable to changes in that variable
CHEN10011 Engineering Maths - Statistics 46
Resolution• We can use this to calculate the resolution of a
composite measurement:
• Resolution of an individual variable is normally taken as half the scale division of the instrument used
• Can be taken as a determinate error in the measurement
yy
xx
y
xx
y
xx
x xn x xn n x xn
n
1 2
12 1
2
1 1, , ,
CHEN10011 Engineering Maths - Statistics 47
Example 2
• Determination of the density, , of the material weighed in Example 1
• The volume of the material was measured five times
• The resulting volume measurements were:– 6.0, 6.0, 5.8, 5.7, and 6.3 cm3
CHEN10011 Engineering Maths - Statistics 48
Example 2
• Density is given by:
• So the measurement resolution is given by:
m
V
mm
VV
V m
CHEN10011 Engineering Maths - Statistics 49
Example 2• But
• So,
• Note: each term is dimensionally correct
m V
V
1 V
m
Vm
2
m
V
m V
V 2
CHEN10011 Engineering Maths - Statistics 50
Example 2• Since
m = 510-4 g V = 510-2 cm3
– m = 12.475 g – V = 6.0 cm3
• Then
• The resolution of the density determination experiment was 0.017 g cm-3
322
24
cm g1074.10.6
105475.12
0.6
105
CHEN10011 Engineering Maths - Statistics 51
Propagation of Indeterminate Errors
• For functions of a variable:
• In some cases variance is used in the place of standard deviation:
dx
ydSSxfy xy ),(
2
22 ),(
xd
dySSxfy xy
CHEN10011 Engineering Maths - Statistics 52
Propagation of Indeterminate Errors• For linear combinations of variables:
y f x x xn ( , , )1 2
2
2
2
3
2
2
2
2
2
1
2
2
2
2
3
2
2
2
2
2
1
22
321
321
nxxxxy
nxxxxy
x
yS
x
yS
x
yS
x
ySS
x
yS
x
yS
x
yS
x
ySS
n
n
CHEN10011 Engineering Maths - Statistics 53
Propagation of Indeterminate Errors• For linear combinations
• Since
2233
222
211
3322110
nny
nn
SkSkSkSkS
xkxkxkxkky
etc , 22
11
kx
yk
x
y
CHEN10011 Engineering Maths - Statistics 54
Propagation of Indeterminate Errors• For multiplicative combinations
• Or, in general
2
4
4
2
3
3
2
2
2
2
1
1
43
21
x
S
x
S
x
S
x
S
y
S
xx
xkxy
y
2222
21 nxxxy CCCC
CHEN10011 Engineering Maths - Statistics 55
Propagation of Indeterminate Errors• For powers:
• Naively, you might think that xn = xxx…• But the errors in each x are not independent – the
error in x is the same for each occurrence
x
nS
y
S
xy
xy
n
CHEN10011 Engineering Maths - Statistics 56
Propagation of Indeterminate Errors• Going back to our original question:• What is the indeterminate error in the composite
measurement?
• This is a linear combination of the form
• So in this case, k0 = 0, k1 = 1, k2 = -1, k3..n = 0 and x = m
vesselmaterialvesselmaterial mmm
nn xkxkxkxkky 3322110
CHEN10011 Engineering Maths - Statistics 57
Propagation of Indeterminate Errors
• So, given that:
• Then since
• So
2233
222
211 nny SkSkSkSkS
22
21
22
21
222
211
.1.1
mm
mm
mmm
SS
SS
SkSkS
21 mmm
CHEN10011 Engineering Maths - Statistics 58
Propagation of Indeterminate Errors• In general, if using the same instrument to perform the
measurements, then:
• So
• That is, the error in the final mass measurement is larger than the individual errors in the mass measurements
212 mm SS
21 mm SS
CHEN10011 Engineering Maths - Statistics 59
Propagation of Indeterminate Errors
• In our example, the mass measurement had an indeterminate error of 0.012g
• If we perform a subtractive measurement of mass, the indeterminate error in the result will be:
• Result is rounded to the same precision as the original data
g
SS mm
017.0
012.02
2
2
21
CHEN10011 Engineering Maths - Statistics
Paired/Unpaired Observations
• Repeated weighings of the same object allow us to determine the errors in the measuring instrument
• Repeated determinations allow us to determine the errors in the entire operation, including the measuring instrument
60
CHEN10011 Engineering Maths - Statistics
Paired/Unpaired Observations
• Repeated weighings: observations are unpaired• We cannot estimate the standard deviation by
subtracting pairs of empty and full observations, then calculate the standard deviation from these differences
61
CHEN10011 Engineering Maths - Statistics
Paired/Unpaired Observations• Example:
62
Observation Full weight (g)
Empty weight (g)
Difference (g)
1 12.465 9.965 2.500
2 12.466 9.966 2.500
3 12.482 9.982 2.500
4 12.468 9.968 2.500
5 12.481 9.981 2.500
6 12.481 9.981 2.500
7 12.469 9.969 2.500
8 12.472 9.972 2.500
9 12.477 9.977 2.500
10 12.473 9.973 2.500
Mean 12.473 9.973 2.500
Standard deviation 0.006 0.006 0.000
CHEN10011 Engineering Maths - Statistics
Paired/Unpaired Observations• We can see that the standard deviation of the
measuring instrument is 0.006 g• The standard deviation of the paired differences is
zero.• This cannot be correct• This is because of the false pairing
63
CHEN10011 Engineering Maths - Statistics
Paired/Unpaired Observations• If we take a different order of pairings:
64
Observation Full weight (g)
Empty weight (g)
Difference (g)
1 12.465 9.965 2.500
2 12.466 9.966 2.500
3 12.482 9.968 2.514
4 12.468 9.969 2.499
5 12.481 9.972 2.509
6 12.481 9.973 2.508
7 12.469 9.969 2.500
8 12.472 9.977 2.495
9 12.477 9.981 2.496
10 12.473 9.981 2.492
Mean 12.473 9.982 2.501
Standard deviation 0.006 0.006 0.007
CHEN10011 Engineering Maths - Statistics
Paired/Unpaired Observations• This indicates that the pairing can give us wildly
varying estimates of the standard deviation• We should use:
65
g
SSS mmm
0085.0
006.0006.0 22
22
21
CHEN10011 Engineering Maths - Statistics 66
Distributions
• The set of all possible observations is the population
• The measurements we take are a sample of the population
• If there are no determinate errors then the mean of the population is the true value of the mass
• The mean of the population is denoted by
CHEN10011 Engineering Maths - Statistics 67
Distributions• Similarly the standard deviation of the population
would be a measure of the true distribution• The population standard deviation is denoted by
may be zero – for example, the concentration of
an analyte in a given material has a single true value
• Other populations will have non-zero , for example the height of chemical engineering undergraduates
CHEN10011 Engineering Maths - Statistics 68
Distributions
• The true mean of a distribution is given by the symbol • Is the maximum of the probability density function• Formal definition is given by:
• A measurement is an estimate of the probability density function of the observed variable.
dxxFx )(.
CHEN10011 Engineering Maths - Statistics 69
Distributions
• The position of the measurement is given by an estimate of the mean:– is an estimate for .
• The shape of the distribution is provided by an estimate for the standard deviation:– S is an estimate for .
x
CHEN10011 Engineering Maths - Statistics 70
Distributions• As more observations are made of a variable so a
continuous distribution begins to be defined• When an infinite number of observations are
available, the distribution is completely defined• The probability density function (PDF) is the
normalised distribution curve• The area under the PDF is equal to 1
P x F x dx( ) ( ).
1
CHEN10011 Engineering Maths - Statistics 71
Distributions
• That is, there is a probability of 1 that the variable will lie between ±∞
• The probability that the variable will lie between x and x+∆x is given by:
P x x F x dxx
x x
( ) ( ).
CHEN10011 Engineering Maths - Statistics 72
Distributions
x
-4 -2 0 2 4
Fre
qu
en
cy
0.0
0.1
0.2
0.3
0.4
0.5
x x+x
Area under the curve
is the probability that
the variable is in the range x to x+∆x
CHEN10011 Engineering Maths - Statistics 73
Distributions• There are many types of probability density function, but
the three most important are:– Normal distribution, also known as a Gaussian distribution– Poisson distribution, also known as a Stochastic distribution– Binomial distribution
• Normal distributions are common in physical measurements
CHEN10011 Engineering Maths - Statistics 74
Normal Distribution
• A normal distribution with mean μ and standard deviation σ is defined by:
f x e
x( )
1
2 2
2
2
CHEN10011 Engineering Maths - Statistics 75
Normal Distribution
x
-4 -2 0 2 4
Fre
qu
en
cy
0.0
0.1
0.2
0.3
0.4
0.5
CHEN10011 Engineering Maths - Statistics 76
Normal Distribution
• For the normal distribution, the area under the curve bounded by: 1 will contain approximately 68.3% of the population – 2 will contain approximately 95.5% of the population– 3 will contain approximately 99.7% of the population
CHEN10011 Engineering Maths - Statistics 77
Normal Distribution
x
-4 -2 0 2 4
Fre
quen
cy
0.0
0.1
0.2
0.3
0.4
0.5
x
-4 -2 0 2 4
Fre
quen
cy
0.0
0.1
0.2
0.3
0.4
0.5
x
-4 -2 0 2 4
Fre
quen
cy
0.0
0.1
0.2
0.3
0.4
0.5
~68.3% ~95.5% ~99.7%
1
2
3
CHEN10011 Engineering Maths - Statistics 78
Log-normal Distribution
• Encountered in many different situations• Examples include:
– Antibody concentration in blood serum– Aerosol particle size distribution
• In these cases, the variable being measured cannot go below zero
• Can be converted to a normal distribution by taking the log of the variable
CHEN10011 Engineering Maths - Statistics 79
Log-normal Distribution
Log(x)
-1.5 -1.0 -0.5 0.0 0.5 1.0 1.5
y
0.0
0.1
0.2
0.3
0.4
0.5
x
0 2 4 6 8 10 12
y
0.0
0.1
0.2
0.3
0.4
0.5
log(x)
CHEN10011 Engineering Maths - Statistics 80
Student’s t-distribution• The derivation of the t-distribution was first published in
1908 by William Sealy Gosset• He worked at the Guinness Brewery in Dublin• He was not allowed to publish under his own name, so the
paper was written under the pseudonym Student.• The t-test and the associated theory became well-known
through the work of R.A. Fisher, who called the distribution "Student's distribution".
CHEN10011 Engineering Maths - Statistics 81
Student’s t-distribution• Gossett studied the distribution of:
• And showed it was of the form:
• Which is independent of μ and σ• No estimate of σ is required, S can be used
nS
xT
n
n
2/)1(2 )/1()2/(
)2/)1(()(
xxf
CHEN10011 Engineering Maths - Statistics 82
Properties of the t Distribution• It tends to the normal distribution for high numbers
of degrees of freedom• At low degrees of freedom the tails of the t
distribution are higher than the normal distribution
CHEN10011 Engineering Maths - Statistics 83
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 1
CHEN10011 Engineering Maths - Statistics 84
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 2
CHEN10011 Engineering Maths - Statistics 85
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 3
CHEN10011 Engineering Maths - Statistics 86
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 4
CHEN10011 Engineering Maths - Statistics 87
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 5
CHEN10011 Engineering Maths - Statistics 88
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 6
CHEN10011 Engineering Maths - Statistics 89
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 7
CHEN10011 Engineering Maths - Statistics 90
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 8
CHEN10011 Engineering Maths - Statistics 91
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 9
CHEN10011 Engineering Maths - Statistics 92
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 10
CHEN10011 Engineering Maths - Statistics 93
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 15
CHEN10011 Engineering Maths - Statistics 94
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 20
CHEN10011 Engineering Maths - Statistics 95
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 25
CHEN10011 Engineering Maths - Statistics 96
Properties of the t Distribution
x
-4 -2 0 2 4
Pro
bab
ility
0.0
0.1
0.2
0.3
0.4
= 30
CHEN10011 Engineering Maths - Statistics 97
Sampling Distribution• If a limited set of observations is made on a variable:• A range of values is obtained and from these the
sample mean and standard distribution can be obtained. – It is unlikely that the sample mean is equal to the true
value for the mean – It is unlikely that the sample standard deviation S is equal
to the true standard deviation .
CHEN10011 Engineering Maths - Statistics 98
Sampling Distribution
• If another set of readings is taken:• This will give new values for the sample mean and
standard deviation • It is unlikely that these new values obtained would
agree with those obtained from the first set of observations.
CHEN10011 Engineering Maths - Statistics 99
Sampling Distribution• If this process is repeated a distribution for x is
obtained • This is the sampling distribution of the mean• It has a mean equal to that of the original population• Its standard deviation is different and is referred to
as the standard error of the mean (SEM) and is defined by:
SEMn
CHEN10011 Engineering Maths - Statistics 100
Central Limit Theorem
• The Central Limit Theorem states that if the sum of many independent random variables has a finite variance, then it will be approximately normally distributed
• That is, it will have a normal or Gaussian distribution).
CHEN10011 Engineering Maths - Statistics 101
Central Limit Theorem
• Since measured variables are often the sum of many independent random variables, normal distributions are common
CHEN10011 Engineering Maths - Statistics 102
0.0
0.2
0.4
0.6
0.8
1.0
1.2
24
6
8
100
2
4
6
8
10
x
n
Central Limit Theorem
CHEN10011 Engineering Maths - Statistics 103
0.0
0.2
0.4
0.6
0.8
1.0
1.2
24
6
8
100
2
4
6
8
10
x
n
Central Limit Theorem
CHEN10011 Engineering Maths - Statistics 104
0.0
0.2
0.4
0.6
0.8
1.0
1.2
24
6
8
100
2
4
6
8
10
x
n
Central Limit Theorem
CHEN10011 Engineering Maths - Statistics 105
Central Limit Theorem
• See also:– http://www.vias.org/simulations/simusoft_cenlimit.html– http://www.socr.ucla.edu/htmls/SOCR_Experiments.html– http://www.statisticalengineering.com/central_limit_theor
em.htm
CHEN10011 Engineering Maths - Statistics 106
Accuracy and Precision• Accuracy is defined by the trueness of a
measurement. • An accurate measurement is one which produces
a value for equal to , without any systematic error.
x
CHEN10011 Engineering Maths - Statistics 107
Accuracy and Precision• A precise measurement produces a value for S
that is as close to zero as possible• Indeterminate error may arise from the variable
under observation as well as the measurement• In this case, a precise measurement would
produce a standard deviation (S) as close as possible to the standard deviation () of the observed variable
CHEN10011 Engineering Maths - Statistics 108
Accuracy and Precision• Precision and accuracy describe two different
properties of a measurement• Accuracy refers to measurements of central
tendency• Precision refers to measurements of dispersion• ACCURACY DOES NOT IMPLY PRECISION• PRECISION DOES NOT IMPLY ACCURACY
CHEN10011 Engineering Maths - Statistics 109
Accuracy and Precision
Observed Value
-15 -10 -5 0 5 10 15
No
rma
lise
d N
um
be
r o
f O
bse
rva
tio
ns
0.0
0.1
0.2
0.3
0.4
0.5
A
B
C
D
A: Precise and accurateB: Imprecise and accurateC: Precise and inaccurateD: Imprecise and inaccurate
CHEN10011 Engineering Maths - Statistics 110
Accuracy and Precision• Accuracy is tested by calibration and validation
methods• E.g. through the analysis of certified national and
international standards• Precision (indeterminate error) is best reported
through the use of confidence limits at a specified level of probability
CHEN10011 Engineering Maths - Statistics 111
Reporting of Measurements• Precision is best reported through the use of
confidence limits at a specified level of probability• Explicitly states that indeterminate errors are being
reported• A clear and straightforward format for reporting
confidence limits would be:• at the P% confidence limit for n measurementsx E
• Precision is best reported through the use of confidence limits at a specified level of probability
• Explicitly states that indeterminate errors are being reported
• A clear and straightforward format for reporting confidence limits would be:
• at the P% confidence limit for n measurements
CHEN10011 Engineering Maths - Statistics 112
Confidence Limits• Definition of a range within which we have a certain
confidence we will find the true value• This assumes an absence of systematic errors• For large samples we can assume that the sample
standard deviation S is a good estimate for the population standard deviation, σ
CHEN10011 Engineering Maths - Statistics 113
Confidence Limits
• Using the sampling distribution of the mean, we find that for 95% confidence level:
• Or,
n
Sx
n
Sx 96.196.1
n
Sx 96.1
CHEN10011 Engineering Maths - Statistics 114
Confidence Limits• For small samples, S is unlikely to be a good
estimate for σ• We use Student’s t distribution to allow us to use S
in place of σ:
n
Stx nP 1,
CHEN10011 Engineering Maths - Statistics 115
Confidence Limits• For our previous measurements of mass,
• We use the two-tailed value of t at the 95% confidence level to estimate our confidence limits:
g
g
n
Stx nP
056.0475.124721.4
012.0093.2475.12
1,
20 ,012.0 ,475.12 ngSgx
tsmeasuremen 20for level confidence 95% at the
CHEN10011 Engineering Maths - Statistics 116
T Tableα 0.05 0.025 0.005 0.0025 0.0005 0.00025
2α 0.1 0.05 0.01 0.005 0.001 0.0005ν 1 6.314 12.706 63.657 127.321 636.619 1273.2392 2.920 4.303 9.925 14.089 31.599 44.7053 2.353 3.182 5.841 7.453 12.924 16.3264 2.132 2.776 4.604 5.598 8.610 10.3065 2.015 2.571 4.032 4.773 6.869 7.9766 1.943 2.447 3.707 4.317 5.959 6.7887 1.895 2.365 3.499 4.029 5.408 6.0828 1.860 2.306 3.355 3.833 5.041 5.6179 1.833 2.262 3.250 3.690 4.781 5.291
10 1.812 2.228 3.169 3.581 4.587 5.04911 1.796 2.201 3.106 3.497 4.437 4.86312 1.782 2.179 3.055 3.428 4.318 4.71613 1.771 2.160 3.012 3.372 4.221 4.59714 1.761 2.145 2.977 3.326 4.140 4.49915 1.753 2.131 2.947 3.286 4.073 4.41716 1.746 2.120 2.921 3.252 4.015 4.34617 1.740 2.110 2.898 3.222 3.965 4.28618 1.734 2.101 2.878 3.197 3.922 4.23319 1.729 2.093 2.861 3.174 3.883 4.18720 1.725 2.086 2.845 3.153 3.850 4.14625 1.708 2.060 2.787 3.078 3.725 3.99630 1.697 2.042 2.750 3.030 3.646 3.90240 1.684 2.021 2.704 2.971 3.551 3.78850 1.676 2.009 2.678 2.937 3.496 3.723∞ 1.645 1.960 2.576 2.807 3.291 3.481
CHEN10011 Engineering Maths - Statistics 117
T Table
• See also:– Statistical Tables, J. Murdoch and J.A. Barnes, 4th Edition,
McMillan, ISBN 0333558596– Table 7, page 17
CHEN10011 Engineering Maths - Statistics 118
T Table
• Generated using the Excel TINV function:– TINV(p, ν)– p is the probability associated with the two-tailed Student's t-
distribution– ν is the number of degrees of freedom– Use 2p to obtain the one-tailed value
CHEN10011 Engineering Maths - Statistics 119
Statistical Tests• Presence of indeterminate error means it is unlikely
that:– The mean of one sample will agree exactly with the
mean of a second sample– Means generated using different methods will agree– Variances of two samples will be the same
• We can use statistical tests to establish the probability that these differences are a result of indeterminate error
CHEN10011 Engineering Maths - Statistics 120
Statistical Tests• Null Hypothesis (H0)• An exact statement of something we initially
suppose to be true• For example, we may propose that the means of two
samples are the same, and that any observed difference is a result of random error:
210 : xxH
CHEN10011 Engineering Maths - Statistics 121
Statistical Tests• The alternate hypothesis not simply the opposite of
H0
• In this case, there are three possibilities:
• The first two alternate hypotheses are one-tailed• The third alternate hypothesis is two-tailed
211
211
211
:
:
:
xxH
xxH
xxH
CHEN10011 Engineering Maths - Statistics 122
Statistical Tests• One-tailed tests:
– Direction of difference is important• Two-tailed tests:
– Direction of difference is unimportant• Example:
– Drug trials – H0 is typically that the drug has no effect
– H1 is that the drug produces an improvement in the condition treated (does not make it worse!)
– This is a one-tailed test
CHEN10011 Engineering Maths - Statistics 123
Statistical Tests
• Example:– Validation of one measurement method against another– H0 is typically that the two means are the same
– H1 is that the means are different– This is a two-tailed test
CHEN10011 Engineering Maths - Statistics 124
Statistical Tests
• Confidence level (P)– Usually expressed as a percentage– Typically 95%, 99%, 99.9%– Is a measure of how likely it is that the observed
differences are NOT a result of indeterminate error– For 95% confidence level, there is a 1 in 20 chance that
the difference is a result of indeterminate error
CHEN10011 Engineering Maths - Statistics 125
Statistical Tests• Confidence level (P)
– Related to the probability (α)– For a one tailed test
– For a two tailed test
%1001or %100)1(
PP
2%100
1or %100)21(
P
P
CHEN10011 Engineering Maths - Statistics 126
Statistical Tests
P (%) α90 0.1095 0.0599 0.01
99.9 0.001
P (%) α90 0.0595 0.02599 0.005
99.9 0.0005
One-tailed Two-tailed
CHEN10011 Engineering Maths - Statistics 127
Statistical Tests• Possible errors:
– Type 1: rejection of the null hypothesis even though it is in fact true
– Type 2: acceptance of the null hypothesis even though it is false
CHEN10011 Engineering Maths - Statistics 128
Statistical Tests
Type I errorType II error
xc
Sampling distribution of mean if null
hypothesis is true
Sampling distribution of
mean if alternate hypothesis is true
CHEN10011 Engineering Maths - Statistics 129
Statistical Tests• Reducing the chance of a Type I error increases the
chance of a Type II error• Reducing the chance of a Type II error increases the
chance of a Type I error• Only by increasing the sample size can we reduce
the chances of both types of error• This is because we then reduce the standard error
of the mean
CHEN10011 Engineering Maths - Statistics 130
Statistical Tests
Type I errorType II error
xc
Type I errorType II error
xc
Increased number of observations
CHEN10011 Engineering Maths - Statistics 131
Testing for Normality• Parametric statistical tests assume that the data are
described by a particular distribution• This is most often the normal (or Gaussian) distribution• The Central Limit Theorem shows that normal
distributions are common• We may need to test if our data are normally distributed
before performing further statistical tests
CHEN10011 Engineering Maths - Statistics 132
Testing for Normality
• We can use the Kolmogorov test (also called the Kolmogorov-Smirnov test)
• This test can be used for any distribution that has a known cumulative distribution function
• The null hypothesis is that the sample comes from the hypothesized distribution (the normal distribution in this case)
CHEN10011 Engineering Maths - Statistics 133
Testing for Normality
• To do this, we need to know the population mean µ and the population standard deviation σ
• We cannot use the sample mean and standard deviation S in this case
• The null hypothesis in this case is that all the observations are drawn from a normal distribution with mean µ and standard deviation σ
x
CHEN10011 Engineering Maths - Statistics 134
Testing for Normality• For the normal distribution, the cumulative distribution function
is given by:
• where
2
12
1
x
erfC
97531
)12(
0
16
105
8
15
4
3
2
11
2
!!1211
2
2
xxxxxe
xne
xerf
x
n
nn
nx
CHEN10011 Engineering Maths - Statistics 135
Testing for Normality• Tests if the data sample is compatible with being a
random sampling from a given distribution• In this case, the assumed distribution is normal• First, we calculate the fractional cumulative
frequency distribution for our sample
1
n
frequencycumulativeNS
CHEN10011 Engineering Maths - Statistics 136
Testing for Normality• Note we use n+1 as the divisor, not n to ensure that the
50% cumulative frequency falls in the middle of the sample• This is because the mid-point with the divisor n is:
• If we use the divisor n+1:
n
nnn
ncentre2
1
2
1
5.0)1(2
1
211
1
n
nnn
ncentre
CHEN10011 Engineering Maths - Statistics 137
Testing for Normality• To make the test easier, we normalise the variable
we are sampling:
• This has the effect of converting the variable to a normal distribution with:– Mean = 0 – Standard deviation = 1
• This is referred to as N(0,1)
Standard normal value x x
Si
CHEN10011 Engineering Maths - Statistics 138
Testing for Normality• We then find:
• for all x• Where F(x) is the expected cumulative frequency for x• We compare DN against critical values from tables
• If the DN value is greater than the critical value, we can reject the null hypothesis
• We can say that our sample does not have the same distribution as F(x)
)()(max xFxSD NN
CHEN10011 Engineering Maths - Statistics 139
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09
0.0 0.5000 0.4960 0.4920 0.4880 0.4840 0.4801 0.4761 0.4721 0.4681 0.46410.1 0.4602 0.4562 0.4522 0.4483 0.4443 0.4404 0.4364 0.4325 0.4286 0.42470.2 0.4207 0.4168 0.4129 0.4090 0.4052 0.4013 0.3974 0.3936 0.3897 0.38590.3 0.3821 0.3783 0.3745 0.3707 0.3669 0.3632 0.3594 0.3557 0.3520 0.34830.4 0.3446 0.3409 0.3372 0.3336 0.3300 0.3264 0.3228 0.3192 0.3156 0.31210.5 0.3085 0.3050 0.3015 0.2981 0.2946 0.2912 0.2877 0.2843 0.2810 0.27760.6 0.2743 0.2709 0.2676 0.2643 0.2611 0.2578 0.2546 0.2514 0.2483 0.24510.7 0.2420 0.2389 0.2358 0.2327 0.2296 0.2266 0.2236 0.2206 0.2177 0.21480.8 0.2119 0.2090 0.2061 0.2033 0.2005 0.1977 0.1949 0.1922 0.1894 0.18670.9 0.1841 0.1814 0.1788 0.1762 0.1736 0.1711 0.1685 0.1660 0.1635 0.16111.0 0.1587 0.1562 0.1539 0.1515 0.1492 0.1469 0.1446 0.1423 0.1401 0.13791.1 0.1357 0.1335 0.1314 0.1292 0.1271 0.1251 0.1230 0.1210 0.1190 0.11701.2 0.1151 0.1131 0.1112 0.1093 0.1075 0.1056 0.1038 0.1020 0.1003 0.09851.3 0.0968 0.0951 0.0934 0.0918 0.0901 0.0885 0.0869 0.0853 0.0838 0.08231.4 0.0808 0.0793 0.0778 0.0764 0.0749 0.0735 0.0721 0.0708 0.0694 0.06811.5 0.0668 0.0655 0.0643 0.0630 0.0618 0.0606 0.0594 0.0582 0.0571 0.05591.6 0.0548 0.0537 0.0526 0.0516 0.0505 0.0495 0.0485 0.0475 0.0465 0.04551.7 0.0446 0.0436 0.0427 0.0418 0.0409 0.0401 0.0392 0.0384 0.0375 0.03671.8 0.0359 0.0351 0.0344 0.0336 0.0329 0.0322 0.0314 0.0307 0.0301 0.02941.9 0.0287 0.0281 0.0274 0.0268 0.0262 0.0256 0.0250 0.0244 0.0239 0.02332.0 0.0228 0.0222 0.0217 0.0212 0.0207 0.0202 0.0197 0.0192 0.0188 0.01832.1 0.0179 0.0174 0.0170 0.0166 0.0162 0.0158 0.0154 0.0150 0.0146 0.01432.2 0.0139 0.0136 0.0132 0.0129 0.0125 0.0122 0.0119 0.0116 0.0113 0.01102.3 0.0107 0.0104 0.0102 0.0099 0.0096 0.0094 0.0091 0.0089 0.0087 0.00842.4 0.0082 0.0080 0.0078 0.0075 0.0073 0.0071 0.0069 0.0068 0.0066 0.00642.5 0.0062 0.0060 0.0059 0.0057 0.0055 0.0054 0.0052 0.0051 0.0049 0.00482.6 0.0047 0.0045 0.0044 0.0043 0.0041 0.0040 0.0039 0.0038 0.0037 0.00362.7 0.0035 0.0034 0.0033 0.0032 0.0031 0.0030 0.0029 0.0028 0.0027 0.00262.8 0.0026 0.0025 0.0024 0.0023 0.0023 0.0022 0.0021 0.0021 0.0020 0.00192.9 0.0019 0.0018 0.0018 0.0017 0.0016 0.0016 0.0015 0.0015 0.0014 0.00143.0 0.0013 0.0013 0.0013 0.0012 0.0012 0.0011 0.0011 0.0011 0.0010 0.00103.1 0.0010 0.0009 0.0009 0.0009 0.0008 0.0008 0.0008 0.0008 0.0007 0.00073.2 0.0007 0.0007 0.0006 0.0006 0.0006 0.0006 0.0006 0.0005 0.0005 0.00053.3 0.0005 0.0005 0.0005 0.0004 0.0004 0.0004 0.0004 0.0004 0.0004 0.00033.4 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0003 0.0002
Areas in the upper tail of the Normal distribution
CHEN10011 Engineering Maths - Statistics 140
Using Table 3• If the SNV is negative:
– Ignore the sign– Look up the row corresponding to the first two digits X.X– Look up the column corresponding to the third digit 0.0X– The value at the intersection is the correct value
• If the SNV is positive:– Look up the value as before– Subtract the table value from 1– This is the correct value
CHEN10011 Engineering Maths - Statistics 141
Using Table 3• This is because we want the area in the lower tail,
but the values tabulated are the upper tail• Since the total area is 1, the area in the lower tail is
1 – area in lower tail
x
-4 -2 0 2 4
Fre
quen
cy
0.0
0.1
0.2
0.3
0.4
0.5
Tabulated value
1 - Tabulated value
CHEN10011 Engineering Maths - Statistics 142
Cumulative Frequency for the Normal Distribution• Table generated using Excel• Using the NORMDIST function:
– NORMDIST(x, mean, s, cumulative)– x is the value for which you want the distribution– mean is the arithmetic mean of the distribution– s is the standard deviation of the distribution– cumulative is true (1) if the cumulative value is required,
otherwise false (0) if the probability is required
CHEN10011 Engineering Maths - Statistics 143
Cumulative Frequency for the Normal Distribution• Can also use NORMSDIST:
– NORMSDIST(x)– x is the value for which you want the distribution– Returns the cumulative frequency at x for a standard normal
distribution (mean = 0, standard deviation = 1)
• This is the same as:– NORMDIST(x, 0, 1, 1)
CHEN10011 Engineering Maths - Statistics 144
Cumulative Frequency for the Normal Distribution• Firstly, we will test to see if the observations are consistent
with being drawn from a normal distribution with a mean of 12.480 g and a standard deviation of 0.010 g
• In this case, the null hypothesis is that the observations are drawn from a normal distribution with µ = 12.480 g and σ = 0.010 g
• We calculate the SNV as:010.0
480.12ix
CHEN10011 Engineering Maths - Statistics 145
Testing for NormalityValue Standard
Normal Value (normalised to N(0,1))
Number of occurrences
Cumulative frequency
Fractional cumulative frequency
Expected cumulative frequency
|expected-actual| cumulative frequency
12.450 -3 1 1 0.04760 0.00135 0.04625
12.465 -1.5 2 3 0.14290 0.06681 0.07609
12.466 -1.4 1 4 0.19050 0.08076 0.10974
12.468 -1.2 1 5 0.23810 0.11507 0.12303
12.469 -1.1 1 6 0.28570 0.13567 0.15003
12.472 -0.8 1 7 0.33330 0.21186 0.12144
12.473 -0.7 2 9 0.42860 0.24196 0.18664
12.474 -0.6 1 10 0.47620 0.27425 0.20195
12.475 -0.5 3 13 0.61900 0.30854 0.31046
12.477 -0.3 1 14 0.66670 0.38209 0.28461
12.481 0.1 2 16 0.76190 0.53983 0.22207
12.482 0.2 1 17 0.80950 0.57926 0.23024
12.485 0.5 2 19 0.90480 0.69146 0.21334
12.513 3.3 1 20 0.95240 0.99952 0.04712
CHEN10011 Engineering Maths - Statistics
Weight (g)
12.42 12.44 12.46 12.48 12.50 12.52 12.54
Fra
ctio
nal C
umul
ativ
e F
requ
ency
0.0
0.2
0.4
0.6
0.8
1.0
1.2
Observed Fractional Cumulative FrequencyExpected Cumulative Frequency
146
Testing for Normality
DN
CHEN10011 Engineering Maths - Statistics 147
Table of Kologorov-Smirnov Critical Valuesn α=0.20 α=0.15 α=0.10 α=0.05 α=0.01
1 0.900 0.925 0.950 0.975 0.995
2 0.684 0.726 0.776 0.842 0.929
3 0.565 0.597 0.642 0.708 0.828
4 0.494 0.525 0.564 0.624 0.733
5 0.446 0.474 0.510 0.565 0.669
6 0.410 0.436 0.470 0.521 0.618
7 0.381 0.405 0.438 0.486 0.577
8 0.358 0.381 0.411 0.457 0.543
9 0.339 0.360 0.388 0.432 0.514
10 0.322 0.342 0.368 0.410 0.490
11 0.307 0.326 0.352 0.391 0.468
12 0.295 0.313 0.338 0.375 0.450
13 0.284 0.302 0.325 0.361 0.433
14 0.274 0.292 0.314 0.349 0.418
15 0.266 0.283 0.304 0.338 0.404
CHEN10011 Engineering Maths - Statistics 148
Table of Kologorov-Smirnov Critical Valuesn α=0.20 α=0.15 α=0.10 α=0.05 α=0.01
16 0.258 0.274 0.295 0.328 0.392
17 0.250 0.266 0.286 0.318 0.381
18 0.244 0.259 0.278 0.309 0.371
19 0.237 0.252 0.272 0.301 0.363
20 0.231 0.246 0.264 0.294 0.356
25 0.210 0.220 0.240 0.270 0.320
30 0.190 0.200 0.220 0.240 0.290
35 0.180 0.190 0.210 0.230 0.270
16 0.258 0.274 0.295 0.328 0.392
17 0.250 0.266 0.286 0.318 0.381
18 0.244 0.259 0.278 0.309 0.371
19 0.237 0.252 0.272 0.301 0.363
20 0.231 0.246 0.264 0.294 0.356
25 0.210 0.220 0.240 0.270 0.320
30 0.190 0.200 0.220 0.240 0.290
CHEN10011 Engineering Maths - Statistics 149
Table of Kologorov-Smirnov Critical Values
n α=0.20 α=0.15 α=0.10 α=0.05 α=0.01
35 0.180 0.190 0.210 0.230 0.270
>35n
22.1
n
14.1
n
36.1
n
07.1
n
63.1
CHEN10011 Engineering Maths - Statistics 150
Testing for Normality• Our null hypothesis is that the observations are consistent
with being drawn from a normal distribution with a mean of 12.480 g and a standard deviation of 0.010 g
• For 20 samples and 95% confidence level, the critical value is:– 0.294– Our DN is 0.3105
CHEN10011 Engineering Maths - Statistics 151
Testing for Normality• We thus reject the null hypothesis and accept the alternate
hypothesis that the observations are not normally distributed with a mean of 12.480 g and a standard deviation of 0.010 g
• We cannot say from this if there are any other normal distributions that would be consistent with these observations
CHEN10011 Engineering Maths - Statistics 152
Testing for Normality• What do we do if we do not know the distribution
parameters in advance?• We can estimate them from the sample mean and sample
standard deviation• In this case, the null hypothesis is that the observations are
consistent with being drawn from a normal distribution with µ = and σ = S
• We perform the test in a similar way, but use the sample mean and standard deviation to calculate the SNV
x
CHEN10011 Engineering Maths - Statistics 153
Testing for Normality• This is Lilliefors’ variant of the K-S test• Because the distribution has been estimated from
the data:– The hypothesized distribution is closer to the original
data– The maximum difference will be smaller– A new table of critical values is required
CHEN10011 Engineering Maths - Statistics 154
Testing for NormalityValue Standard
Normal Value (normalised to N(0,1))
Number of occurrences
Cumulative frequency
Fractional cumulative frequency
Expected cumulative frequency
|expected-actual| cumulative frequency
12.450 -2.0679 1 1 0.0476 0.0193 0.0283
12.465 -0.8272 2 3 0.1429 0.2041 0.0612
12.466 -0.7444 1 4 0.1905 0.2283 0.0378
12.468 -0.5790 1 5 0.2381 0.2813 0.0432
12.469 -0.4963 1 6 0.2857 0.3098 0.0241
12.472 -0.2481 1 7 0.3333 0.4020 0.0688
12.473 -0.1654 2 9 0.4286 0.4343 0.0057
12.474 -0.0827 1 10 0.4762 0.4670 0.0092
12.475 0.0000 3 13 0.6190 0.5000 0.1190
12.477 0.1654 1 14 0.6667 0.5657 0.1010
12.481 0.4963 2 16 0.7619 0.6902 0.0717
12.482 0.5790 1 17 0.8095 0.7187 0.0908
12.485 0.8272 2 19 0.9048 0.7959 0.1089
12.513 3.1432 1 20 0.9524 0.9992 0.0468
CHEN10011 Engineering Maths - Statistics 155
Testing for Normality
Normalised Value
-4 -3 -2 -1 0 1 2 3 4
Fra
ctio
na
l Cu
mu
lativ
e F
req
ue
ncy
0.00
0.25
0.50
0.75
1.00
DN
CHEN10011 Engineering Maths - Statistics 156
Lilliefors Critical Valuesn α=0.20 α=0.15 α=0.10 α=0.05 α=0.01
4 0.3027 0.3216 0.3456 0.3754 0.4129
5 0.2893 0.3027 0.3188 0.3427 0.3959
6 0.2694 0.2816 0.2982 0.3245 0.3728
7 0.2521 0.2641 0.2802 0.3041 0.3504
8 0.2387 0.2502 0.2649 0.2875 0.3331
9 0.2273 0.2382 0.2522 0.2744 0.3162
10 0.2171 0.2273 0.2410 0.2616 0.3037
11 0.2080 0.2179 0.2306 0.2506 0.2905
12 0.2004 0.2101 0.2228 0.2426 0.2812
13 0.1932 0.2025 0.2147 0.2337 0.2714
14 0.1869 0.1959 0.2077 0.2257 0.2627
15 0.1811 0.1899 0.2016 0.2196 0.2545
16 0.1758 0.1843 0.1956 0.2128 0.2477
17 0.1711 0.1794 0.1902 0.2071 0.2408
18 0.1666 0.1747 0.1852 0.2018 0.2345
19 0.1624 0.1700 0.1803 0.1965 0.2285
20 0.1589 0.1666 0.1764 0.1920 0.2226
CHEN10011 Engineering Maths - Statistics 157
Lilliefors Critical Valuesn α=0.20 α=0.15 α=0.10 α=0.05 α=0.01
21 .1553 .1629 .1726 .1881 .2190
22 .1517 .1592 .1690 .1840 .2141
23 .1484 .1555 .1650 .1798 .2090
24 .1458 .1527 .1619 .1766 .2053
25 .1429 .1498 .1589 .1726 .2010
26 .1406 .1472 .1562 .1699 .1985
27 .1381 .1448 .1533 .1665 .1941
28 .1358 .1423 .1509 .1641 .1911
29 .1334 .1398 .1483 .1614 .1886
30 .1315 .1378 .1460 .1590 .1848
31 .1291 .1353 .1432 .1559 .1820
32 .1274 .1336 .1415 .1542 .1798
33 .1254 .1314 .1392 .1518 .1770
34 .1236 .1295 .1373 .1497 .1747
35 .1220 .1278 .1356 .1478 .1720
CHEN10011 Engineering Maths - Statistics 158
Testing for Normality• Our null hypothesis is that the observations are consistent
with a normal distribution having a mean of 12.475 g and a standard deviation of 0.012 g
• For 20 samples and 95% confidence level, the critical value is:– 0.192– Our DN is 0.119
• We conclude that, at the 95% confidence level, there is no significant deviation from a normal distribution with a mean of 12.475 g and standard deviation of 0.012 g.
CHEN10011 Engineering Maths - Statistics 159
Testing for Normality• Limitations of the K-S and Lilliefors’ test:
– Distribution must be continuous– Most sensitive near the centre of the distribution– Test is weaker if the distribution parameters are
estimated from the data (as in our example)
CHEN10011 Engineering Maths - Statistics 160
Testing for Normality• These tests do not tell us which normal distribution
fits the observations best• That is, which distribution gives the smallest sum of
squares of the residuals
CHEN10011 Engineering Maths - Statistics 161
Testing for Normality• In this case, the best fit (r = 0.9919) is obtained with
µ = 12.4741 g and σ = 0.0085613 g:
Weight (g)
12.42 12.44 12.46 12.48 12.50 12.52 12.54
Fra
ctio
nal C
umul
ativ
e F
requ
enc
y
0.0
0.2
0.4
0.6
0.8
1.0
1.2
Observed Fractional Cumulative FrequencyExpected Cumulative Frequency
CHEN10011 Engineering Maths - Statistics 162
Testing for NormalityValue Standard
Normal Value (normalised to N(0,1))
Number of occurrences
Cumulative frequency
Fractional cumulative frequency
Expected cumulative frequency
|expected-actual| cumulative frequency
12.45 -2.8149931 1 1 0.04760 0.00244 0.04516
12.465 -1.0629227 2 3 0.14290 0.14391 0.00101
12.466 -0.946118 1 4 0.19050 0.17204 0.01846
12.468 -0.7125086 1 5 0.23810 0.23807 0.00003
12.469 -0.5957039 1 6 0.28570 0.27569 0.01001
12.472 -0.2452899 1 7 0.33330 0.40312 0.06982
12.473 -0.1284852 2 9 0.42860 0.44888 0.02028
12.474 -0.0116805 1 10 0.47620 0.49534 0.01914
12.475 0.10512422 3 13 0.61900 0.54186 0.07714
12.477 0.3387336 1 14 0.66670 0.63259 0.03411
12.481 0.80595237 2 16 0.76190 0.78986 0.02796
12.482 0.92275706 1 17 0.80950 0.82193 0.01243
12.485 1.27317113 2 19 0.90480 0.89852 0.00628
12.513 4.54370248 1 20 0.95240 1.00000 0.04760
CHEN10011 Engineering Maths - Statistics 163
Testing for Normality• In this case, the maximum DN is only 0.07714• This is way below the critical value for either the K-
S or Lilliefors’ test• This is what we would expect• The larger sample mean (12.475 g) and standard
deviation (0.012 g) are a result of the one possible outlier (12.513 g)
CHEN10011 Engineering Maths - Statistics 164
Testing for Normality• The best fit is obtained with:
– µ = 12.4741 g and σ = 0.0085613 g• The median and σ derived from the MAD are:
– Median = 12.475 g and σ = 0.00964 g• The σ from MAD is much closer to the best fit value
than S (0.012 g)• This is because it is not affected by outliers
CHEN10011 Engineering Maths - Statistics 165
Testing for Normality• We can see the space of all normal distributions
with this monte carlo approach:
CHEN10011 Engineering Maths - Statistics 166
Statistical Tests• F Tests
– Used for the comparison of standard deviations of samples– Used to determine:– If one set of data is more precise (a one- tailed test)– If two sets are different in their precision (a two-tailed test)– The null hypothesis is that there is no difference in precision
(H0: S1 = S2)
CHEN10011 Engineering Maths - Statistics 167
Statistical Tests
• The F-test looks at the ratio of two sample variances:
• S1 and S2 are chosen such that F 1• The resulting F statistic is compared with a critical
value from tables
FS
S 1
2
22
CHEN10011 Engineering Maths - Statistics 168
Statistical Tests
• The critical values for F are determined by– The numbers of observations in each of the two
samples, n1 and n2
– The confidence level – The type of test performed
• The degrees of freedom for an F-test are given by n1-1 and n2-1
CHEN10011 Engineering Maths - Statistics 169
Statistical Tests• The degrees of freedom are n-1, not n• This is because degrees of freedom refers to the
number of independent deviations used to calculate S
• Since we know S, when we have n-1 deviations we can deduce the final deviation
• This is because
xxi
01
n
ii xx
CHEN10011 Engineering Maths - Statistics 170
Statistical Tests
• Tables of the F distribution are quite cumbersome• This is because they require a separate table for
each confidence level
CHEN10011 Engineering Maths - Statistics 171
Statistical Tests• A different experimental worker repeated the
measurement in Example 1. The data obtained were:– x2=12.501g, S2 = 0.019g, n2 = 5
• The original data were:– x1=12.475g, S1 = 0.012g, n1 = 20
• The null hypothesis adopted is:– – That is, there is no significant difference in the variance
between the two samples at the 95% confidence level–
22
210 : SSH
CHEN10011 Engineering Maths - Statistics 172
Statistical Tests• We calculate the F statistic:
• At the 95% confidence level, degrees of freedom 4 and 19, two-tailed test the critical value is– Fcrit = 3.56
51.21044.1
1061.3
012.0
019.0
4
4
2
2
F
CHEN10011 Engineering Maths - Statistics 173
Statistical Tests
• Since our calculated F statistic is less than the critical value:– We accept the null hypothesis that the variances are the
same at the 95% confidence level
CHEN10011 Engineering Maths - Statistics 174
Statistical Tests• F Table, one-tailed, 95% confidence level (α = 0.05)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201 161.45 199.50 215.71 224.58 230.16 233.99 236.77 238.88 240.54 241.88 242.98 243.91 244.69 245.36 245.95 246.46 246.92 247.32 247.69 248.012 18.51 19.00 19.16 19.25 19.30 19.33 19.35 19.37 19.38 19.40 19.40 19.41 19.42 19.42 19.43 19.43 19.44 19.44 19.44 19.453 10.13 9.55 9.28 9.12 9.01 8.94 8.89 8.85 8.81 8.79 8.76 8.74 8.73 8.71 8.70 8.69 8.68 8.67 8.67 8.664 7.71 6.94 6.59 6.39 6.26 6.16 6.09 6.04 6.00 5.96 5.94 5.91 5.89 5.87 5.86 5.84 5.83 5.82 5.81 5.805 6.61 5.79 5.41 5.19 5.05 4.95 4.88 4.82 4.77 4.74 4.70 4.68 4.66 4.64 4.62 4.60 4.59 4.58 4.57 4.566 5.99 5.14 4.76 4.53 4.39 4.28 4.21 4.15 4.10 4.06 4.03 4.00 3.98 3.96 3.94 3.92 3.91 3.90 3.88 3.877 5.59 4.74 4.35 4.12 3.97 3.87 3.79 3.73 3.68 3.64 3.60 3.57 3.55 3.53 3.51 3.49 3.48 3.47 3.46 3.448 5.32 4.46 4.07 3.84 3.69 3.58 3.50 3.44 3.39 3.35 3.31 3.28 3.26 3.24 3.22 3.20 3.19 3.17 3.16 3.159 5.12 4.26 3.86 3.63 3.48 3.37 3.29 3.23 3.18 3.14 3.10 3.07 3.05 3.03 3.01 2.99 2.97 2.96 2.95 2.94
10 4.96 4.10 3.71 3.48 3.33 3.22 3.14 3.07 3.02 2.98 2.94 2.91 2.89 2.86 2.85 2.83 2.81 2.80 2.79 2.7711 4.84 3.98 3.59 3.36 3.20 3.09 3.01 2.95 2.90 2.85 2.82 2.79 2.76 2.74 2.72 2.70 2.69 2.67 2.66 2.6512 4.75 3.89 3.49 3.26 3.11 3.00 2.91 2.85 2.80 2.75 2.72 2.69 2.66 2.64 2.62 2.60 2.58 2.57 2.56 2.5413 4.67 3.81 3.41 3.18 3.03 2.92 2.83 2.77 2.71 2.67 2.63 2.60 2.58 2.55 2.53 2.51 2.50 2.48 2.47 2.4614 4.60 3.74 3.34 3.11 2.96 2.85 2.76 2.70 2.65 2.60 2.57 2.53 2.51 2.48 2.46 2.44 2.43 2.41 2.40 2.3915 4.54 3.68 3.29 3.06 2.90 2.79 2.71 2.64 2.59 2.54 2.51 2.48 2.45 2.42 2.40 2.38 2.37 2.35 2.34 2.3316 4.49 3.63 3.24 3.01 2.85 2.74 2.66 2.59 2.54 2.49 2.46 2.42 2.40 2.37 2.35 2.33 2.32 2.30 2.29 2.2817 4.45 3.59 3.20 2.96 2.81 2.70 2.61 2.55 2.49 2.45 2.41 2.38 2.35 2.33 2.31 2.29 2.27 2.26 2.24 2.2318 4.41 3.55 3.16 2.93 2.77 2.66 2.58 2.51 2.46 2.41 2.37 2.34 2.31 2.29 2.27 2.25 2.23 2.22 2.20 2.1919 4.38 3.52 3.13 2.90 2.74 2.63 2.54 2.48 2.42 2.38 2.34 2.31 2.28 2.26 2.23 2.21 2.20 2.18 2.17 2.1620 4.35 3.49 3.10 2.87 2.71 2.60 2.51 2.45 2.39 2.35 2.31 2.28 2.25 2.22 2.20 2.18 2.17 2.15 2.14 2.12
Numerator degrees of freedom (ν1)
De
no
min
ato
r d
eg
ree
s o
f fr
ee
do
m (
ν 2)
CHEN10011 Engineering Maths - Statistics 175
Statistical Tests• F Table, two-tailed, 95% confidence level (α = 0.05)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201 647.79 799.50 864.16 899.58 921.85 937.11 948.22 956.66 963.28 968.63 973.03 976.71 979.84 982.53 984.87 986.92 988.73 990.35 991.80 993.102 38.51 39.00 39.17 39.25 39.30 39.33 39.36 39.37 39.39 39.40 39.41 39.41 39.42 39.43 39.43 39.44 39.44 39.44 39.45 39.453 17.44 16.04 15.44 15.10 14.88 14.73 14.62 14.54 14.47 14.42 14.37 14.34 14.30 14.28 14.25 14.23 14.21 14.20 14.18 14.174 12.22 10.65 9.98 9.60 9.36 9.20 9.07 8.98 8.90 8.84 8.79 8.75 8.71 8.68 8.66 8.63 8.61 8.59 8.58 8.565 10.01 8.43 7.76 7.39 7.15 6.98 6.85 6.76 6.68 6.62 6.57 6.52 6.49 6.46 6.43 6.40 6.38 6.36 6.34 6.336 8.81 7.26 6.60 6.23 5.99 5.82 5.70 5.60 5.52 5.46 5.41 5.37 5.33 5.30 5.27 5.24 5.22 5.20 5.18 5.177 8.07 6.54 5.89 5.52 5.29 5.12 4.99 4.90 4.82 4.76 4.71 4.67 4.63 4.60 4.57 4.54 4.52 4.50 4.48 4.478 7.57 6.06 5.42 5.05 4.82 4.65 4.53 4.43 4.36 4.30 4.24 4.20 4.16 4.13 4.10 4.08 4.05 4.03 4.02 4.009 7.21 5.71 5.08 4.72 4.48 4.32 4.20 4.10 4.03 3.96 3.91 3.87 3.83 3.80 3.77 3.74 3.72 3.70 3.68 3.67
10 6.94 5.46 4.83 4.47 4.24 4.07 3.95 3.85 3.78 3.72 3.66 3.62 3.58 3.55 3.52 3.50 3.47 3.45 3.44 3.4211 6.72 5.26 4.63 4.28 4.04 3.88 3.76 3.66 3.59 3.53 3.47 3.43 3.39 3.36 3.33 3.30 3.28 3.26 3.24 3.2312 6.55 5.10 4.47 4.12 3.89 3.73 3.61 3.51 3.44 3.37 3.32 3.28 3.24 3.21 3.18 3.15 3.13 3.11 3.09 3.0713 6.41 4.97 4.35 4.00 3.77 3.60 3.48 3.39 3.31 3.25 3.20 3.15 3.12 3.08 3.05 3.03 3.00 2.98 2.96 2.9514 6.30 4.86 4.24 3.89 3.66 3.50 3.38 3.29 3.21 3.15 3.09 3.05 3.01 2.98 2.95 2.92 2.90 2.88 2.86 2.8415 6.20 4.77 4.15 3.80 3.58 3.41 3.29 3.20 3.12 3.06 3.01 2.96 2.92 2.89 2.86 2.84 2.81 2.79 2.77 2.7616 6.12 4.69 4.08 3.73 3.50 3.34 3.22 3.12 3.05 2.99 2.93 2.89 2.85 2.82 2.79 2.76 2.74 2.72 2.70 2.6817 6.04 4.62 4.01 3.66 3.44 3.28 3.16 3.06 2.98 2.92 2.87 2.82 2.79 2.75 2.72 2.70 2.67 2.65 2.63 2.6218 5.98 4.56 3.95 3.61 3.38 3.22 3.10 3.01 2.93 2.87 2.81 2.77 2.73 2.70 2.67 2.64 2.62 2.60 2.58 2.5619 5.92 4.51 3.90 3.56 3.33 3.17 3.05 2.96 2.88 2.82 2.76 2.72 2.68 2.65 2.62 2.59 2.57 2.55 2.53 2.5120 5.87 4.46 3.86 3.51 3.29 3.13 3.01 2.91 2.84 2.77 2.72 2.68 2.64 2.60 2.57 2.55 2.52 2.50 2.48 2.46
Numerator degrees of freedom (ν1)
De
no
min
ato
r d
eg
ree
s o
f fr
ee
do
m (
ν 2)
CHEN10011 Engineering Maths - Statistics 176
Statistical Tests• F Table, one-tailed, 99% confidence level (α = 0.01)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201 4052.2 4999.5 5403.4 5624.6 5763.6 5859.0 5928.4 5981.1 6022.5 6055.8 6083.3 6106.3 6125.9 6142.7 6157.3 6170.1 6181.4 6191.5 6200.6 6208.72 98.50 99.00 99.17 99.25 99.30 99.33 99.36 99.37 99.39 99.40 99.41 99.42 99.42 99.43 99.43 99.44 99.44 99.44 99.45 99.453 34.12 30.82 29.46 28.71 28.24 27.91 27.67 27.49 27.35 27.23 27.13 27.05 26.98 26.92 26.87 26.83 26.79 26.75 26.72 26.694 21.20 18.00 16.69 15.98 15.52 15.21 14.98 14.80 14.66 14.55 14.45 14.37 14.31 14.25 14.20 14.15 14.11 14.08 14.05 14.025 16.26 13.27 12.06 11.39 10.97 10.67 10.46 10.29 10.16 10.05 9.96 9.89 9.82 9.77 9.72 9.68 9.64 9.61 9.58 9.556 13.75 10.92 9.78 9.15 8.75 8.47 8.26 8.10 7.98 7.87 7.79 7.72 7.66 7.60 7.56 7.52 7.48 7.45 7.42 7.407 12.25 9.55 8.45 7.85 7.46 7.19 6.99 6.84 6.72 6.62 6.54 6.47 6.41 6.36 6.31 6.28 6.24 6.21 6.18 6.168 11.26 8.65 7.59 7.01 6.63 6.37 6.18 6.03 5.91 5.81 5.73 5.67 5.61 5.56 5.52 5.48 5.44 5.41 5.38 5.369 10.56 8.02 6.99 6.42 6.06 5.80 5.61 5.47 5.35 5.26 5.18 5.11 5.05 5.01 4.96 4.92 4.89 4.86 4.83 4.81
10 10.04 7.56 6.55 5.99 5.64 5.39 5.20 5.06 4.94 4.85 4.77 4.71 4.65 4.60 4.56 4.52 4.49 4.46 4.43 4.4111 9.65 7.21 6.22 5.67 5.32 5.07 4.89 4.74 4.63 4.54 4.46 4.40 4.34 4.29 4.25 4.21 4.18 4.15 4.12 4.1012 9.33 6.93 5.95 5.41 5.06 4.82 4.64 4.50 4.39 4.30 4.22 4.16 4.10 4.05 4.01 3.97 3.94 3.91 3.88 3.8613 9.07 6.70 5.74 5.21 4.86 4.62 4.44 4.30 4.19 4.10 4.02 3.96 3.91 3.86 3.82 3.78 3.75 3.72 3.69 3.6614 8.86 6.51 5.56 5.04 4.69 4.46 4.28 4.14 4.03 3.94 3.86 3.80 3.75 3.70 3.66 3.62 3.59 3.56 3.53 3.5115 8.68 6.36 5.42 4.89 4.56 4.32 4.14 4.00 3.89 3.80 3.73 3.67 3.61 3.56 3.52 3.49 3.45 3.42 3.40 3.3716 8.53 6.23 5.29 4.77 4.44 4.20 4.03 3.89 3.78 3.69 3.62 3.55 3.50 3.45 3.41 3.37 3.34 3.31 3.28 3.2617 8.40 6.11 5.18 4.67 4.34 4.10 3.93 3.79 3.68 3.59 3.52 3.46 3.40 3.35 3.31 3.27 3.24 3.21 3.19 3.1618 8.29 6.01 5.09 4.58 4.25 4.01 3.84 3.71 3.60 3.51 3.43 3.37 3.32 3.27 3.23 3.19 3.16 3.13 3.10 3.0819 8.18 5.93 5.01 4.50 4.17 3.94 3.77 3.63 3.52 3.43 3.36 3.30 3.24 3.19 3.15 3.12 3.08 3.05 3.03 3.0020 8.10 5.85 4.94 4.43 4.10 3.87 3.70 3.56 3.46 3.37 3.29 3.23 3.18 3.13 3.09 3.05 3.02 2.99 2.96 2.94
Numerator degrees of freedom (ν1)
De
no
min
ato
r d
eg
ree
s o
f fr
ee
do
m (
ν 2)
CHEN10011 Engineering Maths - Statistics 177
Statistical Tests• F Table, two-tailed, 99% confidence level (α = 0.01)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201 16211 19999 21615 22500 23056 23437 23715 23925 24091 24224 24334 24426 24505 24572 24630 24681 24727 24767 24803 248362 198.50 199.00 199.17 199.25 199.30 199.33 199.36 199.37 199.39 199.40 199.41 199.42 199.42 199.43 199.43 199.44 199.44 199.44 199.45 199.453 55.55 49.80 47.47 46.19 45.39 44.84 44.43 44.13 43.88 43.69 43.52 43.39 43.27 43.17 43.08 43.01 42.94 42.88 42.83 42.784 31.33 26.28 24.26 23.15 22.46 21.97 21.62 21.35 21.14 20.97 20.82 20.70 20.60 20.51 20.44 20.37 20.31 20.26 20.21 20.175 22.78 18.31 16.53 15.56 14.94 14.51 14.20 13.96 13.77 13.62 13.49 13.38 13.29 13.21 13.15 13.09 13.03 12.98 12.94 12.906 18.63 14.54 12.92 12.03 11.46 11.07 10.79 10.57 10.39 10.25 10.13 10.03 9.95 9.88 9.81 9.76 9.71 9.66 9.62 9.597 16.24 12.40 10.88 10.05 9.52 9.16 8.89 8.68 8.51 8.38 8.27 8.18 8.10 8.03 7.97 7.91 7.87 7.83 7.79 7.758 14.69 11.04 9.60 8.81 8.30 7.95 7.69 7.50 7.34 7.21 7.10 7.01 6.94 6.87 6.81 6.76 6.72 6.68 6.64 6.619 13.61 10.11 8.72 7.96 7.47 7.13 6.88 6.69 6.54 6.42 6.31 6.23 6.15 6.09 6.03 5.98 5.94 5.90 5.86 5.83
10 12.83 9.43 8.08 7.34 6.87 6.54 6.30 6.12 5.97 5.85 5.75 5.66 5.59 5.53 5.47 5.42 5.38 5.34 5.31 5.2711 12.23 8.91 7.60 6.88 6.42 6.10 5.86 5.68 5.54 5.42 5.32 5.24 5.16 5.10 5.05 5.00 4.96 4.92 4.89 4.8612 11.75 8.51 7.23 6.52 6.07 5.76 5.52 5.35 5.20 5.09 4.99 4.91 4.84 4.77 4.72 4.67 4.63 4.59 4.56 4.5313 11.37 8.19 6.93 6.23 5.79 5.48 5.25 5.08 4.94 4.82 4.72 4.64 4.57 4.51 4.46 4.41 4.37 4.33 4.30 4.2714 11.06 7.92 6.68 6.00 5.56 5.26 5.03 4.86 4.72 4.60 4.51 4.43 4.36 4.30 4.25 4.20 4.16 4.12 4.09 4.0615 10.80 7.70 6.48 5.80 5.37 5.07 4.85 4.67 4.54 4.42 4.33 4.25 4.18 4.12 4.07 4.02 3.98 3.95 3.91 3.8816 10.58 7.51 6.30 5.64 5.21 4.91 4.69 4.52 4.38 4.27 4.18 4.10 4.03 3.97 3.92 3.87 3.83 3.80 3.76 3.7317 10.38 7.35 6.16 5.50 5.07 4.78 4.56 4.39 4.25 4.14 4.05 3.97 3.90 3.84 3.79 3.75 3.71 3.67 3.64 3.6118 10.22 7.21 6.03 5.37 4.96 4.66 4.44 4.28 4.14 4.03 3.94 3.86 3.79 3.73 3.68 3.64 3.60 3.56 3.53 3.5019 10.07 7.09 5.92 5.27 4.85 4.56 4.34 4.18 4.04 3.93 3.84 3.76 3.70 3.64 3.59 3.54 3.50 3.46 3.43 3.4020 9.94 6.99 5.82 5.17 4.76 4.47 4.26 4.09 3.96 3.85 3.76 3.68 3.61 3.55 3.50 3.46 3.42 3.38 3.35 3.32
Numerator degrees of freedom (ν1)
De
no
min
ato
r d
eg
ree
s o
f fr
ee
do
m (
ν 2)
CHEN10011 Engineering Maths - Statistics 178
F Tables
• See also:– Statistical Tables, J. Murdoch and J.A. Barnes, 4th Edition,
McMillan, ISBN 0333558596– Table 9, pages 20-21– This is the one-tailed table where each entry contains the α=0.05,
0.025, 0.01 and 0.001 values
CHEN10011 Engineering Maths - Statistics 179
Statistical Tests
• Tables generated using Excel• Three functions used for F tests• FTEST(array1, array2)
– Returns the probability that the observed difference in standard deviations of array1 and array2 are a result of indeterminate error.
– Is always a two-tailed test in Excel
CHEN10011 Engineering Maths - Statistics 180
Statistical Tests• FDIST(x, v1, v2)
– For a variable x, returns the probability that a random variable with an F distribution and degrees of freedom v1 and v2 will be greater than x.
• FINV(α, v1, v2)– Inverse function to FDIST– Returns the value x corresponding to the probability α that a
random variable with an F distribution and degrees of freedom v1 and v2 will be greater than x
CHEN10011 Engineering Maths - Statistics 181
Statistical Tests• Both FDIST and FINV are one-tailed, so the
probability has to be changed if a two-tailed result is require
• Use half the required probability for the two-tailed value
CHEN10011 Engineering Maths - Statistics 182
Statistical Tests• t Tests
– Used to compare means– Three types of test:
• Comparison of a mean to reference value• Comparison of two means• Comparison of more than two means
CHEN10011 Engineering Maths - Statistics 183
Statistical Tests• Comparison of a mean to reference value• Remember that:
• So, rearranging:
n
Stx nP 1,
S
nxt nP 1,
CHEN10011 Engineering Maths - Statistics 184
Statistical Tests• Comparison of a mean to reference value
– Our null hypothesis is:–– We compare the calculated t value against a critical value from
tables– If the modulus of t is greater than the critical value then the null
hypothesis is rejected– Since we are only interested in determining if the means are
different, we use a two-tailed t-test– If we wanted to determine if one mean was greater than the other,
we would use a one-tailed test
xH :0
CHEN10011 Engineering Maths - Statistics 185
Statistical Tests
• The material weighed in Example 1 was obtained from a machine set to deliver 12.45g per operation – Is the unit operating outside its specification?– In this case the null hypothesis is that =12.45g, = 12.475g, n = 20, S = 0.012g
x x
t 12 475 12 4520
0 0129 317. .
..
CHEN10011 Engineering Maths - Statistics 186
Statistical Tests
• The critical value for t at the 95% confidence limit with 19 degrees of freedom is 2.093
• The calculated t-value is much greater, so:– The null hypothesis (that the means are equal) is
rejected– The alternative hypothesis (that the means are
different) is accepted
CHEN10011 Engineering Maths - Statistics 187
Statistical Tests
• Comparison of the Means of Two Samples• The t-test is used to test if the means of two
samples is significant• The null hypothesis is that the two means are not
significantly different• Firstly, we perform an F-test to see if the variances
are significantly different (two-tailed F-test)
CHEN10011 Engineering Maths - Statistics 188
Statistical Tests
• If the variances are not significantly different, the t value is calculated using:
• The degrees of freedom are given by:
t
x x
Sn n
1 2
1 2
1 1
n n1 2 2
CHEN10011 Engineering Maths - Statistics 189
Statistical Tests
• A “pooled” value for the standard deviation is used• This is a weighted average of the two sample
variances:
Sn S n S
n n2 1 1
22 2
2
1 2
1 1
2
CHEN10011 Engineering Maths - Statistics 190
Statistical Tests
• If the standard deviations are significantly different, a different calculation is used:
t
x x
S
n
S
n
1 2
12
1
22
2
CHEN10011 Engineering Maths - Statistics 191
Statistical Tests• The degrees of freedom are given by:
• Rounded to the nearest integer
2
11 2
2
2
22
1
2
1
21
2
2
22
1
21
n
nS
n
nS
nS
nS
CHEN10011 Engineering Maths - Statistics 192
Statistical Tests
• From the earlier mass measurements, the means were noticeably different
• Is this difference significant?• The null hypothesis is:• We have already performed the F-test and shown
that the standard deviations are not significantly different, so we use the first set of equations
210 : xxH
CHEN10011 Engineering Maths - Statistics 193
Statistical Tests
• Pooled standard deviation:
• T value:
g 0.01349
1082.1
2520
019.04012.019
24
222
S
g
S
854.3
51
201
01349.0
501.12475.12
t
CHEN10011 Engineering Maths - Statistics 194
Statistical Tests• (20 + 5 - 2 ) = 23 degrees of freedom• At the 95% confidence level (P = 0.05)• A two-tailed test (we have no a priori reason to
suppose that one mean will be greater than the other)
• The critical t value is is 2.069
CHEN10011 Engineering Maths - Statistics 195
Statistical Tests• Our calculated t statistic is larger
– We therefore reject the null hypothesis– We accept the alternate hypothesis that the means are
significantly different
CHEN10011 Engineering Maths - Statistics 196
Rejection of Data
• A set of data may contain outliers• These are points far away from the bulk of the
data• They may be a result of determinate error• Removing “inconvenient” results is wrong• Care must be taken when removing outliers
CHEN10011 Engineering Maths - Statistics 197
Rejection of Data
• If an outlier exists:• Check the the experimental procedures operating
at the time the datum was obtained.• Check records and observations to try to identify
the cause of the outlier• You may identify weaknesses in record keeping
and experimental procedures
CHEN10011 Engineering Maths - Statistics 198
Rejection of Data• If no determinate error is identified:• It is nevertheless highly unlikely that the outlier lies
on the probability density function• The expected frequency of such an observation is
so low that it would require a very large sample size to observe it
• Consequently such an outlier is more likely to contain determinate error, so the outlier may be rejected
CHEN10011 Engineering Maths - Statistics 199
Rejection of Data
• Note: The most important data are the ones that don't conform to existing models
CHEN10011 Engineering Maths - Statistics 200
Criteria for the Rejection of Data • Chauvanet’s criterion
– Null hypothesis is that all observations are from the same Normal distribution
– Remove outlier from set of observations– Recalculate mean and standard deviation– Calculate confidence limits at an appropriate
confidence level– If the presumed outlier is outside the confidence limits,
then we reject the null hypothesis
CHEN10011 Engineering Maths - Statistics 201
Criteria for the Rejection of Data • For our weight data:
– Removing the suspected outlier from the set leaves 19 observations with a mean of 12.473 g and a standard deviation of 0.00841 g.
– The confidence limits are given by:
g
g
n
Stx np
477.12469.12
004054.0473.1219
00841.0101.2473.12
1,
CHEN10011 Engineering Maths - Statistics 202
Criteria for the Rejection of Data • Where n´= n – 1 and n is the original number of
observations• We have used the 95% confidence level• Our presumed outlier is outside the confidence
limits• We reject the null hypothesis and accept the
alternate hypothesis that the observation is from another population – it is an outlier
• This test should only be used once per sample
CHEN10011 Engineering Maths - Statistics 203
Criteria for the Rejection of Data• Dixon’s (or Q) test• Works for small sample sizes• Null hypothesis is that all the data are from the same
Normal distribution• A rank difference ratio (Q statistic) is calculated that
depends on the sample size• This is compared to a critical value from tables
CHEN10011 Engineering Maths - Statistics 204
Criteria for the Rejection of DataRank Difference Ratio (Q statistic) n α = 0.10 α = 0.05 α = 0.01
3 0.886 0.941 0.9884 0.679 0.765 0.8895 0.557 0.642 0.7806 0.482 0.560 0.6987 0.434 0.507 0.6378 0.650 0.710 0.8299 0.594 0.657 0.776
10 0.551 0.612 0.72611 0.517 0.576 0.67912 0.490 0.546 0.64213 0.467 0.521 0.61514 0.448 0.501 0.59315 0.472 0.525 0.61616 0.454 0.507 0.59517 0.438 0.490 0.57718 0.424 0.475 0.56119 0.412 0.462 0.54720 0.401 0.450 0.535
or 1
1
1
12
xx
xx
xx
xx
n
nn
n
or 2
2
11
13
xx
xx
xx
xx
n
nn
n
or 3
2
12
13
xx
xx
xx
xx
n
nn
n
CHEN10011 Engineering Maths - Statistics 205
Criteria for the Rejection of Data• If the calculated Q value is larger than the critical
value, then the null hypothesis is rejected• The alternate hypothesis is accepted that the outlier
comes from a different distribution
CHEN10011 Engineering Maths - Statistics 206
Rejection of Data• Using the data from Example 1:
• The critical value for 20 observations is 0.45 at the 95% confidence level
• Our value exceeds this, so we can reject the null hypothesis
• We accept the alternate hypothesis that the point is an outlier
583.0465.12513.12
485.12513.12
3
2
xx
xxQ
n
nn
CHEN10011 Engineering Maths - Statistics 207
Criteria for the Rejection of Data • Grubb’s test
– ISO recommended method– The suspect value is that furthest away from the mean– Null hypothesis is that all measurements are from the
same population– We calculate:
S
xG
luesuspect va
CHEN10011 Engineering Maths - Statistics 208
Criteria for the Rejection of Data • Presence of an outlier increases both the
numerator and the denominator• The G statistic therefore cannot increase
indefinitely• In fact, G cannot exceed:
n
nG
1
CHEN10011 Engineering Maths - Statistics 209
Criteria for the Rejection of Data Critical values for Grubb’s test
n Gcrit,
= 0.05
Gcrit,
= 0.01
n Gcrit,
= 0.05
Gcrit,
= 0.01
n Gcrit,
= 0.05
Gcrit,
= 0.01
3 1.1543 1.1547 15 2.5483 2.8061 80 3.3061 3.6729
4 1.4812 1.4962 16 2.5857 2.8521 90 3.3477 3.7163
5 1.7150 1.7637 17 2.6200 2.8940 100 3.3841 3.7540
6 1.8871 1.9728 18 2.6516 2.9325 120 3.4451 3.8167
7 2.0200 2.1391 19 2.6809 2.9680 140 3.4951 3.8673
8 2.1266 2.2744 20 2.7082 3.0008 160 3.5373 3.9097
9 2.2150 2.3868 25 2.8217 3.1353 180 3.5736 3.9460
10 2.2900 2.4821 30 2.9085 3.2361 200 3.6055 3.9777
11 2.3547 2.5641 40 3.0361 3.3807 300 3.7236 4.0935
12 2.4116 2.6357 50 3.1282 3.4825 400 3.8032 4.1707
13 2.4620 2.6990 60 3.1997 3.5599 500 3.8631 4.2283
14 2.5073 2.7554 70 3.2576 3.6217 600 3.9109 4.2740
CHEN10011 Engineering Maths - Statistics 210
Rejection of Data• From our data in Example 1, the most extreme
value is 12.513 g, which is just over 3 standard deviations from the mean
• Is this point an outlier at the 95% confidence level?• Our null hypothesis is that the data are all from the
same distribution (that is, the point is not an outlier)
3.1432012.0
475.12513.12
S
xluesuspect vaG
CHEN10011 Engineering Maths - Statistics 211
Rejection of Data• The calculated value of G is:
• The critical value for 20 observations is 2.7082• Our value exceeds this, so we can reject the null
hypothesis at the 95% confidence level• We accept the alternate hypothesis that the point is
an outlier
3.1432012.0
475.12513.12
S
xluesuspect vaG
CHEN10011 Engineering Maths - Statistics 212
Rejection of Data• Concluding Comments on the Rejection of Data
– It is important to always retain and report outliers– They may contain important information that you are
unaware of– Explain the basis for their exclusion from your data
analysis– Do not hide such data, even if it is highly inconvenient
and even embarrassing to report it– History may attach a great deal more importance to it
than you do.
CHEN10011 Engineering Maths - Statistics 213
Regression and Correlation• Instrumental analysis techniques are often used to
determine the concentration of an analyte over a wide range
• A calibration curve is obtained from the analysis of reference standards
• The unknown concentration of analyte in a sample yields a response
• The unknown analyte concentration can be interpolated using the calibration graph.
CHEN10011 Engineering Maths - Statistics 214
Regression and Correlation• Important questions are raised in adopting such an
approach.– Is the graph linear? If not, what is the form of the
curve?– As each calibration point is subject to indeterminate
error, then what is the best straight line through the data?
– What errors are present in the fitted curve?– What is the error in a determined concentration?– What is the limit of detection?
CHEN10011 Engineering Maths - Statistics 215
Regression and Correlation
• An important assumption is made in conventional linear regression analysis:– There is no error in x axis values
• That is, • Reduced Major Axis methods can produce a
regression line where
S Sx y
S Sx y
CHEN10011 Engineering Maths - Statistics 216
Regression and Correlation• The “goodness of fit” is measured by the product-moment
correlation coefficient, r• Also known as just the correlation coefficient
• It measures how much of the variance of the dependent (y) variable is accounted for by the variance of the independent (x) variable
rx x y y
x x y y
i ii
n
i ii
n
i
n
( )( )
( ) . ( )
1
2 2
11
CHEN10011 Engineering Maths - Statistics 217
Regression and Correlation
• The alternative form just uses sums:
• The advantage of this form is that only the sums of x, y, xy, x2 and y2 need be accumulated.
rn x y x y
n x x n y y
i ii
n
ii
n
ii
n
i ii
n
i
n
i ii
n
i
n
1 1 1
2
1
2
1
2
1
2
1
CHEN10011 Engineering Maths - Statistics 218
Regression and Correlation• A "perfect" straight line fit will result in r = 1• The sign of r is determined by the sign of the
gradient of the line:
X
0 1 2 3 4 5 6 7 8
Y
0
1
2
3
4
5
6
7
8
r = +1
X
0 1 2 3 4 5 6 7 8
Y
0
1
2
3
4
5
6
7
8
r = -1
CHEN10011 Engineering Maths - Statistics 219
Regression and Correlation• It should be noted that the correlation coefficient
can give very low correlations when there is an obvious relationship between the dependent and independent variables:
X Data
0 2 4 6 8 10 12
Y D
ata
0
1
2
3
4
5
6
7
R=0
CHEN10011 Engineering Maths - Statistics 220
Regression and Correlation• Indeterminate errors may cause a large scatter of
points about the best-fit line.• In such cases a t-test may be used to determine if
a low value for r is significant• The null hypothesis adopted in such instances is
that y is not correlated to x• In fact, the null hypothesis is that r is not
significantly different from zero
CHEN10011 Engineering Maths - Statistics 221
Regression and Correlation• A two-tailed t-test is used and if t is greater than
the critical value at the adopted confidence level then the hypothesis is rejected:
• Where the number of degrees of freedom is given by:
tr n
r
2
1 2
n 2
CHEN10011 Engineering Maths - Statistics 222
Regression and Correlation
• We use a two-tailed test because we are only interested if the correlation coefficient is significantly different from zero (no correlation)
• Unless we have a reason to suppose that there will be a specific direction of correlation, when we use a one-tailed test
CHEN10011 Engineering Maths - Statistics 223
Regression and Correlation
• Alternatively, we can use tables of critical values for the correlation coefficient at given probabilities
• Example: Table 10 in Murdoch and Barnes• In this case, the probabilities at the head of the
table are the two-tailed values• They should be halved for a one-tailed test
CHEN10011 Engineering Maths - Statistics 224
Critical Values of the Correlation Coefficient α 0.05 0.025 0.005 0.0025 0.0005 0.00025 2α 0.1 0.05 0.01 0.005 0.001 0.0005
ν = 1 0.98769 0.99692 0.999877 0.999969 0.99999877 0.99999969 2 0.9000 0.9500 0.9900 0.995000 0.999000 0.999500 3 0.8054 0.8783 0.9587 0.97404 0.99114 0.99442 4 0.7293 0.8114 0.9172 0.9417 0.9741 0.98169 5 0.6694 0.7545 0.8745 0.9056 0.9509 0.96287 6 0.6215 0.7067 0.8343 0.8697 0.9249 0.9406 7 0.5822 0.6664 0.7977 0.8359 0.8983 0.9170 8 0.5494 0.6319 0.7646 0.8046 0.8721 0.8932 9 0.5214 0.6021 0.7348 0.7759 0.8470 0.8699 10 0.4973 0.5760 0.7079 0.7496 0.8233 0.8475 11 0.4762 0.5529 0.6835 0.7255 0.8010 0.8262 12 0.4575 0.5324 0.6614 0.7034 0.7800 0.8060 13 0.4409 0.5140 0.6411 0.6831 0.7604 0.7869 14 0.4259 0.4973 0.6226 0.6643 0.7419 0.7689 15 0.4124 0.4821 0.6055 0.6470 0.7247 0.7519 16 0.4000 0.4683 0.5897 0.6308 0.7084 0.7358 17 0.3887 0.4555 0.5751 0.6158 0.6932 0.7207 18 0.3783 0.4438 0.5614 0.6018 0.6788 0.7063 19 0.3687 0.4329 0.5487 0.5886 0.6652 0.6927 20 0.3598 0.4227 0.5368 0.5763 0.6524 0.6799 25 0.3233 0.3809 0.4869 0.5243 0.5974 0.6244 30 0.2960 0.3494 0.4487 0.4840 0.5541 0.5802 40 0.2573 0.3044 0.3932 0.4252 0.4896 0.5139 50 0.2306 0.2732 0.3542 0.3836 0.4432 0.4659
CHEN10011 Engineering Maths - Statistics 225
Regression and Correlation• Least Squares Fitting• A least squares fit is used to draw a straight line
through data that minimises the residuals in the y-axis:
X Data
0 2 4 6 8 10 12
Y D
ata
0
2
4
6
8
10
12
Residual
CHEN10011 Engineering Maths - Statistics 226
Regression and Correlation
• We minimise the sum of the squares of the residuals
• The residual is the vertical difference between the actual y value and the y value calculated from the regression line
CHEN10011 Engineering Maths - Statistics 227
Regression and Correlation
• For a straight line of form y = a+bx the coefficients b and a are given by:
b
x x y y
x x
i ii
n
ii
n
1
1
a y bx
CHEN10011 Engineering Maths - Statistics 228
Regression and Correlation
• Or:
• Once again, these forms only require simple sums of x, y, xy and x2
bn x y x y
n x x
i ii
n
ii
n
ii
n
i ii
n
i
n
1 1 1
2
1
2
1
ay b x
n
ii
n
ii
n
1 1
CHEN10011 Engineering Maths - Statistics 229
Regression and Correlation• It is important to provide an estimate of the uncertainty in
the slope and intercept calculated through a least squares fit
• This is especially so when involved in the characterisation of a systems response to a proposed factor.
• The first stage is to calculate the y residuals• These are the differences between the calculated data
and the observed data for a given value of yi
yi xi
CHEN10011 Engineering Maths - Statistics 230
Regression and Correlation
• Having done this a statistic is obtained:
• This is the standard deviation of the residuals between the data points and the best fit line
S
y y
ny
x
i ii
n
2
1
2
CHEN10011 Engineering Maths - Statistics 231
Regression and Correlation
• It has the same units as the y values• This is used to estimate the standard deviation in
b, Sb, and a, Sa
• It can be considered an estimate of the random errors in the y measurement
• It may not be a good estimate as the errors may scale with the magnitude of y
CHEN10011 Engineering Maths - Statistics 232
Regression and Correlation• We can also define:
Q x x xx
n
Q y y yy
n
Q x x y y x yx y
n
x ii
n
ii
n ii
n
y ii
n
ii
n ii
n
xy i ii
n
i ii
n ii
n
ii
n
2
1
2
1
1
2
2
1
2
1
1
2
1 1
1 1
CHEN10011 Engineering Maths - Statistics 233
Regression and Correlation• Which leads to alternatives for calculating r and b:
x
xy
yx
xy
Q
Qb
Qr
CHEN10011 Engineering Maths - Statistics 234
Regression and Correlation• Which also leads to an alternative formulation for Sy/x:
• Which does not involve the calculation of the individual values and can be performed using only the sums of x, y, xy, x2 and y2.
S
Q
ny
x
yxy
x
2
2
yi
CHEN10011 Engineering Maths - Statistics 235
Regression and Correlation• Then Sb:
• And Sa:
S
S
x x
S
Qb
yx
ii
n
yx
x
2
1
S S
x
n x xS
x
na y
x
ii
n
ii
n b
ii
n
2
1
2
1
2
1
CHEN10011 Engineering Maths - Statistics 236
Regression and Correlation
• These estimates for the standard deviation may be used in the normal way in t and F-tests
• We can then use t tests to compare slopes and intercepts
• Also may be used to provide estimates of appropriate confidence limits
CHEN10011 Engineering Maths - Statistics 237
Regression and Correlation• Some graphing packages can show confidence
limits on lines of best fit (e.g. Sigmaplot):Graph of ozone concentration versus time
Time (hours)
0 2 4 6 8 10 12
Ozo
ne
conc
ent
ratio
n (p
pm)
0.0
0.5
1.0
1.5
2.0
2.5
3.0
95% confidence intervals
Best fit line
95% confidence intervals
CHEN10011 Engineering Maths - Statistics 238
Regression and Correlation• Confidence limits on regression lines: Interpolation is OK: Extrapolation is not:
Age of Plasma (s)
0 200 400 600 800 1000 1200
Coa
gula
tion
Tim
e (s
)
18
20
22
24
26
28
30
32
Age of Plasma (s)
0 2000 4000 6000 8000 10000
Coa
gula
tion
Tim
e (s
)
20
40
60
80
100
CHEN10011 Engineering Maths - Statistics 239
Regression and Correlation
• These estimates of the standard deviation of the coefficients a and b may be used to determine the uncertainty that accompanies a value of x0 obtained from the interpolation of an unknown yielding of response of y0
CHEN10011 Engineering Maths - Statistics 240
Regression and Correlation
• An alternative approach is to calculate the standard deviation of x0:
• Note: this is an approximation!
S
S
b n
y y
b x xx
yx
ii
n00
2
2 2
1
11
CHEN10011 Engineering Maths - Statistics 241
Regression and Correlation
• This can be simplified further by substituting for b:
• This is the preferred form for calculation
2
20
0
11
xy
xxy
x Q
yyQ
nb
SS
CHEN10011 Engineering Maths - Statistics 242
Regression and Correlation
• If y0 is the mean of m measurements then this is modified and becomes:
S
S
b m n
y y
b x xx
yx
ii
n00
2
2 2
1
1 1
CHEN10011 Engineering Maths - Statistics 243
Regression and Correlation
• This is simplified further as before to:
2
20
0
11
xy
xxy
x Q
yyQ
nmb
SS
CHEN10011 Engineering Maths - Statistics 244
Regression and Correlation• These expressions are valid if:
• Where t is the value of the t statistic for the appropriate confidence level and n-2 degrees of freedom
• See http://www.rsc.org/images/Brief22_tcm18-51117.pdf for a fuller discussion
05.02
22
xy
xyx
Q
SQt
CHEN10011 Engineering Maths - Statistics 245
Regression and Correlation• How can we minimise the error Sx0?
– By making replicate measurements (m > 1)– By working in the middle of the line– By using a well-determined line (b >> 0)– Maximising
)( 0 yy
S
S
b m n
y y
b x xx
yx
ii
n00
2
2 2
1
1 1
2)( xxi
CHEN10011 Engineering Maths - Statistics 246
Regression and Correlation• The approach described above is widely used, but it is
flawed:– It assumes that x values are free of errors. This is not
necessarily true– It assumes that errors in y values are constant
• This is rarely true. All y values are given equal weighting regardless of the uncertainty associated with them.
• Nevertheless, used carefully linear regression analysis and least squares fit provides useful information.
CHEN10011 Engineering Maths - Statistics 247
Regression and Correlation
• Non-linear Regression• The linear regression method works for any linear
relationship• Many relationships between variables do not
follow a simple linear relationship• May be linearised by the appropriate
transformation
CHEN10011 Engineering Maths - Statistics 248
Regression and Correlation• For example:
• May be linearised by taking logs of both sides:
• We can now plot log y against log x to determine the slope and intercept
y axb
log log logy a b x
CHEN10011 Engineering Maths - Statistics 249
Roach Data - Log data
log(length)
0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3
log
(ma
ss)
-1
0
1
2
3
Roach Data - Raw Data
Length (cm)
4 6 8 10 12 14 16 18
Ma
ss (
g)
-40
-20
0
20
40
60
Regression and Correlation• Example: Fish mass versus length
CHEN10011 Engineering Maths - Statistics 250
Regression and Correlation
• What is wrong with the linear plot?– Below ~6 cm, the fish appear to have negative mass– This is not physically realistic
• From the log-log plot we obtain log a =-1.954 (a = 0.0111g) and b = 3.013, so:
y x0 0111 3 013. .
CHEN10011 Engineering Maths - Statistics 251
Regression and Correlation• Example - Is a correlation significant?• The correlation coefficient for the transformed data
is 0.8733 for 29 observations• Our null hypothesis is that there is no correlation
(H0: r = 0)• If we wish to see if this correlation is significant,
we can determine the t value:
tr n
r
2
1
0 8733 29 2
1 0 87339 314
2 2
.
..
CHEN10011 Engineering Maths - Statistics 252
Regression and Correlation• We use a one-tailed test because we expect a positive
correlation between fish mass and length.• The critical value for a one-tailed t-test with 27 degrees of
freedom at the 99% confidence level is 2.473• This is much less than our calculated t value. • Accordingly, we reject the null hypothesis (that there is no
correlation) • And accept the alternative hypothesis that there is a
positive correlation (H1: r > 0)
CHEN10011 Engineering Maths - Statistics 253
Regression and Correlation
• We can also use tables of critical values of the correlation coefficient
• Example – Table 10 in Murdoch and Barnes• We can also generate our own table from the T
Table using the equation:
22
2
nt
tr
crit
critcrit
CHEN10011 Engineering Maths - Statistics 254
Critical Values of the Correlation Coefficientα 0.05 0.025 0.005 0.0025 0.0005 0.00025
2α 0.1 0.05 0.01 0.005 0.001 0.0005ν 1 0.98769 0.99692 0.999877 0.999969 0.99999877 0.999999692 0.9000 0.9500 0.9900 0.995000 0.999000 0.9995003 0.8054 0.8783 0.9587 0.97404 0.99114 0.994424 0.7293 0.8114 0.9172 0.9417 0.9741 0.981695 0.6694 0.7545 0.8745 0.9056 0.9509 0.962876 0.6215 0.7067 0.8343 0.8697 0.9249 0.94067 0.5822 0.6664 0.7977 0.8359 0.8983 0.91708 0.5494 0.6319 0.7646 0.8046 0.8721 0.89329 0.5214 0.6021 0.7348 0.7759 0.8470 0.8699
10 0.4973 0.5760 0.7079 0.7496 0.8233 0.847511 0.4762 0.5529 0.6835 0.7255 0.8010 0.826212 0.4575 0.5324 0.6614 0.7034 0.7800 0.806013 0.4409 0.5140 0.6411 0.6831 0.7604 0.786914 0.4259 0.4973 0.6226 0.6643 0.7419 0.768915 0.4124 0.4821 0.6055 0.6470 0.7247 0.751916 0.4000 0.4683 0.5897 0.6308 0.7084 0.735817 0.3887 0.4555 0.5751 0.6158 0.6932 0.720718 0.3783 0.4438 0.5614 0.6018 0.6788 0.706319 0.3687 0.4329 0.5487 0.5886 0.6652 0.692720 0.3598 0.4227 0.5368 0.5763 0.6524 0.679925 0.3233 0.3809 0.4869 0.5243 0.5974 0.624430 0.2960 0.3494 0.4487 0.4840 0.5541 0.580240 0.2573 0.3044 0.3932 0.4252 0.4896 0.513950 0.2306 0.2732 0.3542 0.3836 0.4432 0.4659
CHEN10011 Engineering Maths - Statistics 255
Regression and Correlation• Example - Testing the significance of the gradient • We see that the exponent in the relationship is
very close to 3 • This is what we would expect if the fish show
isometric growth• That is, the fish grow uniformly in all three
dimensions• Some fish show allometric growth, which is non
uniform in all three dimensions
CHEN10011 Engineering Maths - Statistics 256
Regression and Correlation• We can perform a t-test on the exponent against
the reference value (3)• Our null hypothesis is that there is no difference
between the observed and reference values• We first calculating the standard deviation of the
exponent (the slope in this case):
S yx01944. Sb
01944
0 6010 3235
.
..
CHEN10011 Engineering Maths - Statistics 257
Regression and Correlation• We calculate t using:
• The critical value for 27 degrees of freedom at the 99% confidence level for a two-tailed test is 2.771
• Our t value is well below this value• We accept the null hypothesis that the slope is not
significantly different from 3.000 at the 99% confidence level
t xn
S 3013 3000
29
0 32350 2164. .
..
CHEN10011 Engineering Maths - Statistics 258
Limits of Detection • IUPAC has proposed that the limit of detection be
defined as:– The response at zero analyte concentration plus three
standard deviations of the response at zero analyte – If a calibration curve is used then the limit of detection
is given by the y axis intercept plus three times the standard deviation associated with that value:
– Limit of detection (LOD) = a Sa 3
CHEN10011 Engineering Maths - Statistics 259
Limits of Detection• From calibration graph:
0
0
a
a+3Sa
LOD
Concentration
Re
spo
nse
CHEN10011 Engineering Maths - Statistics 260
Limits of Detection
• Miller and Miller use Sy/x as an estimate of the error in the intercept
• This may underestimate the LOD if the errors in y are constant
CHEN10011 Engineering Maths - Statistics 261
Limits of Detection
• It may be possible to record the presence of an analyte below this level
• The uncertainty associated with such an observation is such as to make it unreliable