88
A Guide to the Practical Use of Chemometrics - with applications for Static SIMS Joanna Lee, Ian Gilmore National Physical Laboratory, Teddington, UK Email: [email protected] Web: http://www.npl.co.uk/nanoanalysis © Crown Copyright 2008 (c) Crown Copyright 2008

A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

A Guide to the Practical Use of Chemometrics- with applications for Static SIMS

Joanna Lee, Ian GilmoreNational Physical Laboratory, Teddington, UK

Email: [email protected]: http://www.npl.co.uk/nanoanalysis

© Crown Copyright 2008

(c) Crown Copyright 2008

Page 2: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 2

©C

row

n C

opyr

ight

200

8

Contents

1. Introduction2. Linear algebra3. Factor analysis

• Principal component analysis• Multivariate curve resolution

4. Multivariate regression• Multiple linear regression• Principal component regression• Partial least squares regression

5. Classification• Principal component discriminant function analysis• Partial least squares discriminant analysis

6. Conclusion(c) Crown Copyright 2008

Page 3: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 3

©C

row

n C

opyr

ight

200

8

Chemometrics

A. M. C. Davies, Spectroscopy Europe 10 (1998) 28

Chemometrics is the science of relating measurements made on a chemical system to the state of the system via application of mathematical or statistical methods

(c) Crown Copyright 2008

Page 4: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 4

©C

row

n C

opyr

ight

200

8

Multivariate analysis

• Analysis involving a simultaneous statistical procedure for two or more dependent variables, e.g. mass (SIMS) or binding energy (XPS)

• Summarises the data with a large number of dependent variables using a smaller number of statistical variables

0

20

40

60

80

100

120

1990 1995 2000 2005 2010Year of Publication

Num

ber o

f Pub

licat

ions

.

PCAMCRPLSANNsDFA

Multivariate analysis publications insurface chemical analysis

(c) Crown Copyright 2008

Page 5: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 5

©C

row

n C

opyr

ight

200

8

Multivariate analysis

• Advantages– Fast and efficient on modern computers– Statistically valid– Uses all information available– Removes potential bias

• Disadvantages– Lots of different methods, procedures, terminologies– Can be difficult to understand!

(c) Crown Copyright 2008

Page 6: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 6

©C

row

n C

opyr

ight

200

8

Data analysis

SIMS DatasetSIMS

Dataset

How is it related to known properties?

Where are they located?

What chemicalsare on the surface?

Calibration / Quantification

Classification

Identification

Can we predictthese properties?

Which group does it belong to?

Is there an outlierin the data?(c) C

rown Copyright 2008

Page 7: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 7

©C

row

n C

opyr

ight

200

8

Contents

1. Introduction2. Linear algebra

• Vector algebra• Matrix algebra• Rank and projections• Data matrix

3. Factor analysis4. Multivariate regression5. Classification6. Conclusion

(c) Crown Copyright 2008

Page 8: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 8

©C

row

n C

opyr

ight

200

8

Data matrix

X has 3 row and 5 columns →3 × 5 data matrix

⎥⎥⎥

⎢⎢⎢

⎡=

6630122412422201821110329

X

Variables

Sam

ples

Mass spectrum of Sample 1

010203040

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Sample 2

0

10

20

30

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Sample 3

010203040

1 2 3 4 5Mass

Inte

nsity

(c) Crown Copyright 2008

Page 9: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 9

©C

row

n C

opyr

ight

200

8

Vector inner product

x

z y

42

2

b⎥⎥⎥

⎢⎢⎢

⎡=

224

ba

2

4

1

⎥⎥⎥

⎢⎢⎢

⎡=

421

a421

=

==

z

y

x

aaa

Transpose (to exchange rows and columns)

Vector length

[ ]421=′a

222 421 ++=a

Vector Inner Product (‘dot product’)

o54416

242241

.=

=×+×+×=

++=⋅

θ

zzyyxx babababa

θcosbaba =⋅

[ ]⎥⎥⎥

⎢⎢⎢

⎡=′=⋅

224

421baba(c) Crown Copyright 2008

Page 10: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 10

©C

row

n C

opyr

ight

200

8

The smaller is the larger the correlation between a and b

Vector correlations

θcosbaba =′

If then theyare orthogonali.e. at right angles

0=′ba

o90=θ

If they are also of unit lengththen they are orthonormali.e. 1=a 1=b

Orthogonal vectors are uncorrelated

OrthogonalityIf then the vectors are collinear

o0=θa

b Collinearity ab

If then the vectors are neither orthogonal nor collinear – they are correlated

oo 900 ≠≠θ

Correlation a

b

θ

θ

(c) Crown Copyright 2008

Page 11: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 11

©C

row

n C

opyr

ight

200

8

Matrix algebra

• A and B must be the same size• Each corresponding element is

added

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡−

−+⎥

⎤⎢⎣

⎡493161

210021

683142

CBA =+)()()( KIKIKI ×=×+×

Matrix addition

(e.g. pure spectra + noise = experimental data)

• No. of columns of A must be equal no. of rows of B

• Row i of A times column j of B gives the row i and column j of the product matrix AB

CBA =)())(( KIKNNI ×=××

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

×+××+××+××+××+××+×

=⎥⎦

⎤⎢⎣

⎥⎥⎥

⎢⎢⎢

121088

1013

222432142222321224213411

2321

242241

Matrix multiplication

(c) Crown Copyright 2008

Page 12: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 12

©C

row

n C

opyr

ight

200

8

Matrix inversefor a square matrix

(only exists if matrixis ‘full rank’)

Matrix inverse

AAI =⎥⎥⎥

⎢⎢⎢

⎡=

100010001

IIdentity matrix: diagonal of 1s

CAB +=

CBA =We can now solve matrix equation

If A is square

If A is rectangular

CAB 1−=

IAA =1-

Matrix pseudoinversefor a rectangular matrix

[ ] 1−′′=+ AAAAIAA =+

(c) Crown Copyright 2008

Page 13: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 13

©C

row

n C

opyr

ight

200

8

Rank and singularity

723521

=+=+

yxyx

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡⇒

75

2321

yx

Simultaneous equations of any size can be solved by matrices

Rank = number of unique equations. This matrix is rank 2

⎥⎥⎥

⎢⎢⎢

⎡=⎥

⎤⎢⎣

⎥⎥⎥

⎢⎢⎢

1075

422321

yxRow 3 is simply multiple of row 1

so rank = 2

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡−

21

75

2321 1

yxThe matrix inverse. If it cannot be

inverted the matrix is singular

Rank is the number of rows or columns that are linearly independentTo obtain unique solution we require number of variables rank≤

(c) Crown Copyright 2008

Page 14: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 14

©C

row

n C

opyr

ight

200

8

3

Matrix projections

yxa 32 +=

a

x

y

[ ] ⎥⎦

⎤⎢⎣

⎡=

yx

32a

2

x*

y*

30º

3.21.6

⎥⎦

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡−

=⎥⎦

⎤⎢⎣

⎡yx

yx

87.05.05.087.0

**

To write a in terms of x* and y*, wefind its projections on the new axes

projections of aonto new axes new axes

[ ] ⎥⎦

⎤⎢⎣

⎡=

*

*

..yx6123a

The new axes x* and y* can be written in terms of x and y

projections of new axesonto old axes

old axes(c) C

rown Copyright 2008

Page 15: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 15

©C

row

n C

opyr

ight

200

8

Matrix projections

yxa 32 +=

ay

[ ] ⎥⎦

⎤⎢⎣

⎡=

yx

32a

x*

y*

30º

3.21.6

x

[ ] ⎥⎦

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡−

=yx

87.05.05.087.0

6.12.3a

Putting these together,we can write vector a as

projections of aonto new axes projections of

new axesonto old axes

old axes3

2

(c) Crown Copyright 2008

Page 16: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 16

©C

row

n C

opyr

ight

200

8

Data matrixMass spectrum of Sample 1

010203040

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Sample 2

0

10

20

30

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Sample 3

010203040

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Chemical 1

0

2

4

6

8

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Chemical 2

0

2

4

6

1 2 3 4 5Mass

Inte

nsity

60Sample3

42Sample2

15Sample1

Chemical2

Chemical1

⎥⎥⎥

⎢⎢⎢

604215

Variables [mass]

Sam

plesSam

ples

Variables [mass]Chemicals

Chem

icalsData matrixChemical spectraSample

composition =×

⎥⎦

⎤⎢⎣

⎡1152440161

⎥⎥⎥

⎢⎢⎢

6630122412422201821110329

(c) Crown Copyright 2008

Page 17: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 17

©C

row

n C

opyr

ight

200

8

Data matrix

1. Each spectrum can be represented by a vector2. Instead of x, y, z in 3D real space, the axes are mass1, mass2,

mass3… etc in variable space (also ‘data space’)3. Without noise, rank of dataset = number of unique components

4. With random, uncorrelated noise, rank of dataset = number of samples or number of variables, whichever is smaller

⎥⎥⎥

⎢⎢⎢

604215

Variables [mass]

Sam

plesSam

ples

Variables [mass]Chemicals

Chem

icalsData matrixChemical spectraSample

composition =×

⎥⎦

⎤⎢⎣

⎡1152440161

⎥⎥⎥

⎢⎢⎢

6630122412422201821110329

(c) Crown Copyright 2008

Page 18: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 18

©C

row

n C

opyr

ight

200

8

Vector and matrix summary

• Each row of the data matrix contains a spectrum that can be represented by a vector in K dimensional data space(K = no. of mass bins)

• Vectors can be orthogonal (90°), collinear (0°) or correlated

• Vectors can be described using a set of rotated axes by finding their projections onto the new axes

• The rank of a data set represents the number of independent parameters that are needed to fully describe the data

(c) Crown Copyright 2008

Page 19: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 19

©C

row

n C

opyr

ight

200

8

Contents

1. Introduction2. Linear algebra3. Factor analysis

• Principal component analysis (PCA)• Data preprocessing• PCA Examples• Multivariate curve resolution (MCR)• MCR Examples

4. Multivariate regression5. Classification6. Conclusion

(c) Crown Copyright 2008

Page 20: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 20

©C

row

n C

opyr

ight

200

8

Data analysis

SIMS DatasetSIMS

Dataset

How is it related to known properties?

Where are they located?

What chemicalsare on the surface?

Calibration / Quantification

Classification

Identification

Can we predictthese properties?

Which group does it belong to?

Is there an outlierin the data?(c) C

rown Copyright 2008

Page 21: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 21

©C

row

n C

opyr

ight

200

8

Terminology

“… then we add a smidgin of this – that’s less than a dollop, but more than a pinch…”.

A well-defined terminology is essential for ideas and practicesto be communicated clearly and accurately

(c) Crown Copyright 2008

Page 22: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 22

©C

row

n C

opyr

ight

200

8

Terminology

In order to clarify existing terminology and emphasise the relationship between the different multivariate techniques, we are going to adopt the following terminology in this lecture

Terms Here Symbol Definition PCA MCR PLS

Factor -

An axis in the data space representing an underlying dimension that contributes to summarising or accounting for the original data set

Principal Component

Pure Component

Latent Vectors, Latent

Variables

Loadings P Correlation between the original variables and the factors

Loadings, Eigenvector

Component Spectrum Loadings

Scores T Projection of the samples onto the factors

Scores, Projections

Component Concentration Scores

ISO 18115:Part 1:2007, Surface chemical analysis – Vocabulary –Part 1: General terms and terms for the spectroscopies, in draft.

(c) Crown Copyright 2008

Page 23: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 23

©C

row

n C

opyr

ight

200

8

Principal component analysis (PCA)

m1

m2

PCA Factor 1PCA Factor 2

• Factors are directions in the data space that contributes to summarising or accounting for the original data set

• Equivalent to a rotation in data space – factors are new axes• Data described by their projections onto the factors• Factor analysis techniques differ in the way the factors are extracted

PCA is a technique for reducing matrices of data to their lowest dimensionality by describing them using a small number of factors

(c) Crown Copyright 2008

Page 24: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 24

©C

row

n C

opyr

ight

200

8

Principal component analysis (PCA)

PCA follows the factor analysis equation –

Data matrix

Projection of samplesonto factors (scores matrix)

Projection of variablesonto factors (loadings matrix)

Residuals (noise)

EPTX +′=)())(()( KIKNNIKI ×+××=×

EptEPTX +′=+′= ∑=

N

nnn

1

We describes the data X (rank R) using N rotated axes (factors), where N < R. Each factor consists of two vectors, tn (scores vector), and pn (loadings vector)

)1)(1( II ××

I = no. of samplesK = no. of mass unitsN = no. of factors

(c) Crown Copyright 2008

Page 25: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 25

©C

row

n C

opyr

ight

200

8

Raw Data

Data Matrix

Data selection and preprocessing

PCA outline

Covariance Matrix

Matrix multiplication

Eigenvectors and Eigenvalues

Decomposition

PCA Factorsx R

Sort by eigenvalues

ReproductionReproducedData Matrix

Reproduction

PCA Factorsx N

Factor compression

After Malinowski, Factor Analysis in Chemistry, John Wiley & Sons (2002)

(c) Crown Copyright 2008

Page 26: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 26

©C

row

n C

opyr

ight

200

8

Covariance matrix contains information about the variances of data points within the dataset, and is defined as

PCA decomposition

XXZ ′=))(()( KIIKKK ××=×

pZp λ=

In PCA, Z is decomposed into a set of eigenvectors p and associated eigenvalues λ, such that

Eigenvalues and eigenvectors have some special properties:

– Eigenvalues are positive or zero– The number of non-zero eigenvalues = rank of data R– Eigenvectors are orthonormal

)1()1)(( ×=×× KKKK

I = no. of samplesK = no. of mass unitsN = no. of factors

(c) Crown Copyright 2008

Page 27: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 27

©C

row

n C

opyr

ight

200

8

PCA factors

• Because Z is the covariance matrix, eigenvectors of Z are special directions in the data space that is optimal in describing the variance of the data

• Eigenvalues are the amount of variance described by their associated eigenvector

∑=

′=′=R

nnn

1ptPTX

Projection of samples onto

nth factor(scores)

Projection ofvariables onto

nth factor(loadings)

• These eigenvectors are the factors PCA obtain for the factor analysis equation. They are sorted by their eigenvalues

• PCA factors successively capture the largest amount of variance (spread) within the dataset

• Projection of samples onto factors (scores) are orthogonal(c) C

rown Copyright 2008

Page 28: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 28

©C

row

n C

opyr

ight

200

8

• The first factor lies along the major axis of ellipse and accounts for most variation

• Instead of describing the data using correlated variables m1 and m2, we transform them onto a new basis (factors) which are uncorrelated

• By removing higher factors (variances due to noise) we can reduce dimensionality of data ⇒‘factor compression’

PCA – graphical representation

m1

m2

PCA Factor 1PCA Factor 2

m1

m2

PCA Factor 1PCA Factor 2

(c) Crown Copyright 2008

Page 29: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 29

©C

row

n C

opyr

ight

200

8

Number of factors

1 2 3 4 5 6 7 810-15

10-10

10-5

100

105

1010

Eig

enva

lue

1 2 3 4 5 6 7 8101

102

103

104

105

106

107

108

Sorted eigenvector index

(a)

(b)

Data set of 8 spectra from mixing 3 pure compound spectra

no noise

Poisson noisemax 5000 counts

1. Prior knowledge of system

2. ‘Scree test’:Eigenvalue plot levels off in a linearly decreasing manner after 3 factors

3. Percentage of variance captured by Nth

eigenvector:

4. Percentage of total variance captured by N eigenvectors:

%100seigenvalue all of sum

eigenvalue th

×N

%100seigenvalue all of sum

to up seigenvalue of sum×

N

Eig

enva

lue

(c) Crown Copyright 2008

Page 30: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 30

©C

row

n C

opyr

ight

200

8

Data reproduction

X is the reproduced data matrix• reproduced from N selected factors• noise filtered by removal of higher

factors that describe noise variations

• useful for MCR

EptEPTX +′=+′= ∑=

N

nnn

1

PTEXX ′=−=

E is the matrix of residuals• should contain noise only• useful for judging quality of PCA model• may show up unexpected features!

XXE −=

∑=

′−=N

nnn

1ptXE(c) C

rown Copyright 2008

Page 31: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 31

©C

row

n C

opyr

ight

200

8

Raw Data

Data Matrix

Data selection and preprocessing

PCA outline

Covariance Matrix

Matrix multiplication

Eigenvectors and Eigenvalues

Decomposition

PCA Factorsx R

Sort by eigenvalues

ReproductionReproducedData Matrix

Reproduction

PCA Factorsx N

Factor compression

After Malinowski, Factor Analysis in Chemistry, John Wiley & Sons (2002)

(c) Crown Copyright 2008

Page 32: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 32

©C

row

n C

opyr

ight

200

8

Data preprocessing

Data preprocessing is the manipulation of data prior to data analysis…

(c) Crown Copyright 2008

Page 33: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 33

©C

row

n C

opyr

ight

200

8

Data preprocessing

More details in the following slides

• Enhances PCA by bringing out important variance in dataset• Makes assumption about nature of variance in data• Can distort interpretation and quantification

• Includes:– mass binning– peak selection– mean centering– normalisation – variance scaling– Poisson scaling– Binomial scaling– Logarithmic transformation

(c) Crown Copyright 2008

Page 34: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 34

©C

row

n C

opyr

ight

200

8

• Subtract mean spectrum from each sample• PCA describes variations from the mean

Mean centering

x

y

z

Factor 2

Factor 1

Raw data

1st factor goes from origin to centre of gravity of data

y

x

z

Factor 1Factor 2

Mean Centering

1st factor goes from origin and accounts for the highest variance

( ),ki,ki,k :XXX mean−=~

Preprocessed datasample i, mass k Raw data

sample i, mass kMean intensity of mass k

(c) Crown Copyright 2008

Page 35: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 35

©C

row

n C

opyr

ight

200

8

Normalisation

• Divide each spectrum by its total ion intensity

• Reduces effects of topography, sample charging, drift in primary ion current

• Assumes chemical variances can be described by relative changes in ion intensities

• Reduces rank of data by 1

S. N. Deming, J. A. Palasota, J. M. Nocerino, J. Chemomet, 7 (1993) 393

( ):XXX

,,, sum

1i

kiki ×=~

Preprocessed datasample i, mass k Total intensity of sample iRaw data

sample i, mass k

(c) Crown Copyright 2008

Page 36: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 36

©C

row

n C

opyr

ight

200

8

Variance scaling

• Divide each variable by its variance in the dataset• Equalises importance of each variable (i.e. mass)• Problematic for weak peaks – usually used with peak selection• Called ‘auto scaling’ if combined with mean centering

Var

ianc

e

Mean

For each variable (mass, in SIMS spectrum)

Raw data Mean-centering

Variance scaling

Auto scaling

P. Geladi and B. Kowalski, Partial Least-Squares Regression: A Tutorial,Analytica Chimica Acta, 185 (1986) 1

( )kkiki

,,, var

1:X

XX ×=~

Preprocessed datasample i, mass k Variance of mass kRaw data

sample i, mass k

(c) Crown Copyright 2008

Page 37: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 37

©C

row

n C

opyr

ight

200

8

Poisson scaling

• PCA assumes the error associated with each data point is equal

• But SIMS data is dominated by Poisson counting noise –noise variance of a peak is proportional to its intensity

M. R. Keenan, P. G. Kotula, Surf. Interface Anal., 36 (2004) 203

No preprocessingNum of factors?

Poisson scaling4 factors needed

• Divide each data point by the square root of the mean sample intensity and the square root of the mean spectrum

• Provides improved noise rejection in PCA

( ) ( )k:ikiki

,,,, mean

1mean

1

:

~XX

XX ××=Preprocessed datasample i, mass k Mean intensity

of mass k

Raw datasample i, mass k

Mean intensityof sample i

(c) Crown Copyright 2008

Page 38: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 38

©C

row

n C

opyr

ight

200

8

Data preprocessingsummary

Equalises noise variance of each data point. Provides greater noise rejection.Poisson scaling

Equalises variance of every peak regardless of intensity. Best with peak selection.Variance scaling

Equalises total ion yield of each sample and emphasise relative changes in ion intensitiesNormalisation

All factors describe variations from the meanMean centering

First factor goes from origin to mean of dataNo preprocessing

Effect of preprocessingMethod of preprocessing

(c) Crown Copyright 2008

Page 39: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 39

©C

row

n C

opyr

ight

200

8

PCA example (1)

• Three protein compositions (100% fibrinogen, 50% fibrinogen / 50% albumin, 100% albumin) adsorbed onto poly(DTB suberate)

• Loadings on first factor (PC1) shows relative abundance of amino acid peaks of two proteins

• Scores on PC1 separates samples based on protein composition

D.J. Graham et al, Appl. Surf. Sci., 252 (2006) 6860

PC1

Load

ings

(62%

)P

C1

Sco

res

(62%

)

Fib

Alb

(c) Crown Copyright 2008

Page 40: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 40

©C

row

n C

opyr

ight

200

8

PCA example (2)

• SIMS spectra acquired for antiferritin with or without trehalose coating

• Largest variance (PC 1) arises from sample heterogeneity

• PC 2 distinguishes samples protected by trehalose –higher intensities of polar and hydrophilic amino acid fragments

• Trehalose preserves protein conformation in UHV

N. Xia et al, Langmuir, 18 (2002) 4090

(c) Crown Copyright 2008

Page 41: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 41

©C

row

n C

opyr

ight

200

8

PCA example (3)

• 16 different single protein films adsorbed on mica

• Excellent classification of proteins using only 2 factors

• Factors consistent with total amino acid composition of various proteins

• 95% confidence limits provide means for identification / classification

M. Wagner & D. G. Castner, Langmuir, 17 (2001) 4649

PC

2 S

core

s (1

9%)

PC1 Scores (53%)

PC

A L

oadi

ngs

(c) Crown Copyright 2008

Page 42: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 42

©C

row

n C

opyr

ight

200

8

PCA image analysis

I, rows

J, columnsK, m

ass

peaks

• ‘Datacube’ contains a raster of I x J pixels and K mass peaks

• The datacube is rearranged into 2D data matrix with dimensions [(I × J) × K] prior to PCA – ‘unfolding’

• PCA results are folded to form scores images prior to interpretation

9

8

7

6

5

4

3

2

1

963

852

741unfold

(c) Crown Copyright 2008

Page 43: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 43

©C

row

n C

opyr

ight

200

8

2 4 6 8 10 12 14 16 18 20

0

0.2

0.4

0.6

0.8

Sorted eigenvector index

log(

eige

nval

ues)

2 4 6 8 10 12 14 16 18 20-2

-1

0

1

2

Sorted eigenvector index

log(

eige

nval

ues)

2 4 6 8 10 12 14 16 18 20-5

-4.5-4

-3.5-3

-2.5-2

-1.5

Sorted eigenvector index

log(

eige

nval

ues)

PCA image example (1)

Immiscible PC / PVC polymer blend42 counts per pixel on average

Total ion image

Mean centering

Normalisation

Poisson scaling

Only 2 factors needed –dimensionality of image reducedby a factor of 20!

J. L. S. Lee, I. S. Gilmore, “The application of multivariate data analysis techniques in surface analysis”, in Surface Analysis: The Principal Techniques 2nd edition (eds J C Vickerman, I S Gilmore), Wiley.

(c) Crown Copyright 2008

Page 44: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 44

©C

row

n C

opyr

ight

200

8

0 5 10 15 20 25 30 35 40-0.5

0

0.5

1

1.5

2

Mass, u

PCA image example (1)

-5

0

5

10

PCA results after Poisson scaling and mean centering

1st factor distinguishes PVC and PC phases

J. L. S. Lee, I. S. Gilmore, “The application of multivariate data analysis techniques in surface analysis”, in Surface Analysis: The Principal Techniques 2nd edition (eds J C Vickerman, I S Gilmore), Wiley.

PC1 loadings

PC1 scores

-2

0

2

4

6

8

10

0 5 10 15 20 25 30 35 40-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Mass, u

2nd factor shows detector saturation for intense 35Cl peak

PC2 loadings

PC2 scores(c) Crown Copyright 2008

Page 45: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 45

©C

row

n C

opyr

ight

200

8

PCA image example (2)

Hair fibre with multi-component pretreatment

(c) Crown Copyright 2008

Page 46: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 46

©C

row

n C

opyr

ight

200

8

PCA image example (2)

Hair fibre with multi-component pretreatment

Mass, u

Total Spectra

50μm

Total ion

PCA factors are linear combinations of chemical components and optimally describe variance – PCA results can be difficult to interpret!

Image courtesy of DrIan Fletcher, Intertek MSG

J. L. S. Lee, I. S. Gilmore, “The application of multivariate data analysis techniques in surface analysis”, in Surface Analysis: The Principal Techniques 2nd edition (eds J C Vickerman, I S Gilmore), Wiley.

AD

CE

B B

C

D

A

D

C

A

B

PC1 loadings PC2 loadings PC3 loadings

(c) Crown Copyright 2008

Page 47: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 47

©C

row

n C

opyr

ight

200

8

PCA summary

• PCA describes the original data using factors, consisting of loadingsand scores which efficiently accounts for variance in the data

• Eigenvalues give the variance captured by the corresponding factors

• Data preprocessing method needs to be selected with care

• PCA is excellent for discrimination and classification based on differences in spectra, and for identifying important mass peaks

• PCA factors optimally describe variance – PCA results may be difficult to interpret

Data matrixProjection of samples

onto factors (scores matrix)Projection of variables

onto factors (loadings matrix)

Residuals (noise)

EPTX +′=

I = no. of samplesK = no. of mass unitsN = no. of factors

(c) Crown Copyright 2008

Page 48: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 48

©C

row

n C

opyr

ight

200

8

Contents

1. Introduction2. Linear algebra 3. Factor analysis

• Principal component analysis (PCA)• Data preprocessing• PCA Examples• Multivariate curve resolution (MCR)• MCR Examples

4. Multivariate regression5. Classification6. Conclusion

(c) Crown Copyright 2008

Page 49: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 49

©C

row

n C

opyr

ight

200

8

Multivariate curve resolution (MCR)

• PCA factors are directions that describes variance– positive and negative peaks in the loadings– can be difficult to interpret

• We want to resolve original chemical spectra and reverse the following process:

• Use multivariate curve resolution (MCR)

⎥⎥⎥

⎢⎢⎢

⎡=⎥

⎤⎢⎣

⎥⎥⎥

⎢⎢⎢

6630122412422201821110329

1152440161

604215

Variables

Sam

plesS

ampl

es

VariablesChemicals

Chem

icals

Data matrixChemical spectraSample composition =×

(c) Crown Copyright 2008

Page 50: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 50

©C

row

n C

opyr

ight

200

8

Multivariate curve resolution (MCR)

MCR is designed for recovery of chemical spectra and contributions from a multi-component mixture, when little or no prior information about the composition is available

MCR uses an iterative least-squares algorithm to extract solutions, while applying suitable constraints e.g. non-negativity m1

m2 MCR Factor 2

MCR Factor 1

Data matrix

Projection of samplesonto factors (scores matrix)

Projection of variablesonto factors (loadings matrix)

Residuals (noise)

EPTX +′=)())(()( KIKNNIKI ×+××=×

I = no. of samplesK = no. of mass unitsN = no. of factors

(c) Crown Copyright 2008

Page 51: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 51

©C

row

n C

opyr

ight

200

8

Multivariate curve resolution (MCR)

1. Determine number of factors N via eigenvalue plot2. Obtain PCA reproduced data matrix for N factors3. Obtain initial estimates of spectra (loadings) or contributions (scores)

• Random initialisation• PCA loadings or scores• Varimax rotated PCA loadings or scores• Pure variable detection algorithm e.g. SIMPLISMA

4. Constraints• Non-negativity• Equality

5. Convergence criterion6. Alternating least squares (ALS) optimisation

Six Steps to MCR Results

(c) Crown Copyright 2008

Page 52: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 52

©C

row

n C

opyr

ight

200

8

Outline of MCR

Raw Data

Data Matrix

Constraints

MCRScores T

MCRLoadings P

MCR-ALS

ReproducedData Matrix

Initial Estimates

Number of FactorsPCA

(c) Crown Copyright 2008

Page 53: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 53

©C

row

n C

opyr

ight

200

8

• Start with PCA reproduced data matrix

• Assume initial estimate of loadings P

• Steps (1) – (4) are repeated until MCR loadings P and scores T are able to reconstruct reproduced data matrix X within acceptable error specified in convergence criterion

MCR-ALS algorithm

PTX ′=

( )

M

XXE

PTX

XTP

PXT

−=

′=

+=′

+′=

ˆ

ˆ

(1) Find estimate of T using P, applying constraints

(2) Find new estimate of P using T, applying constraints(3) Compute MCR reproduced matrix

(4) Compare results and check convergence

[ ] 1−′′=+ AAAA

Pseudoinverse of rectangular matrix

(c) Crown Copyright 2008

Page 54: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 54

©C

row

n C

opyr

ight

200

8

• MCR solutions are not unique!• Accuracy of resolved spectra depends on the existence of pixels or

samples where there is only contribution from one chemical component

• Peaks for the intense components may appear in spectra resolved for weak components

• Good initial estimates and suitable data preprocessing are essential

m2

Rotational ambiguity

m1

MCR Factor 2

MCR Factor 1

m2

m1

MCR Factor 2

MCR Factor 1

(c) Crown Copyright 2008

Page 55: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 55

©C

row

n C

opyr

ight

200

8

MCR example (1)

• ToF-SIMS depth profiling of copper film grown on TaNcoated silicon wafer

• Manual analysis is difficult, e.g. Si- can arise from SiOx

-, SiN- or silicon substrate

• MCR resolves 8 factors. Loadings resemble SIMS spectra of individual phases and scores resemble their contribution to the depth profile

• Improve signal to noise and correlation of related peaks

K G Lloyd. J. Vac. Sci. Technol. A 25 (2007) 878

Scores for all 8 MCR factors

Scores and loadings for 3 of the MCR factors

(c) Crown Copyright 2008

Page 56: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 56

©C

row

n C

opyr

ight

200

8

MCR image example (1)

Hair fibre with multi-component pretreatment

Mass, u

Total Spectra

MCR scores 1 MCR scores 3 MCR scores 4 MCR scores 5MCR scores 2

Image courtesy of DrIan Fletcher, Intertek MSG

50μm

Total ion

J. L. S. Lee, I. S. Gilmore, “The application of multivariate data analysis techniques in surface analysis”, in Surface Analysis: The Principal Techniques 2nd edition (eds J C Vickerman, I S Gilmore), Wiley.

(c) Crown Copyright 2008

Page 57: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 57

©C

row

n C

opyr

ight

200

8

MCR image example (1)

Scores 1

Scores 3

Scores 4

Scores 5Scores 2

Loadings 1A

Loadings 2

Loadings 3

Loadings 4

Loadings 5B

C

D

Mass, u

Distribution and characteristic peaks are obtained for hair fibre

and four surface chemicalsMass, u

E

Image courtesy of DrIan Fletcher, Intertek MSG

J. L. S. Lee, I. S. Gilmore, “The application of multivariate data analysis techniques in surface analysis”, in Surface Analysis: The Principal Techniques 2nd edition (eds J C Vickerman, I S Gilmore), Wiley.

(c) Crown Copyright 2008

Page 58: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 58

©C

row

n C

opyr

ight

200

8

MCR image example (2)

• We take three pictures and assign each with a SIMS spectra (PBC, PC, PVT)

• The pictures are combined to form a multivariate image dataset• Poisson noise are added to the image (avg ~50 counts per pixel)

PCA Scores 1 PCA Scores 2 PCA Scores 3

(c) Crown Copyright 2008

Page 59: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 59

©C

row

n C

opyr

ight

200

8

MCR image example (2)

• We take three pictures and assign each with a SIMS spectra (PBC, PC, PVT)

• The pictures are combined to form a multivariate image dataset• Poisson noise are added to the image (avg ~50 counts per pixel)

PCA Scores 1 PCA Scores 2 PCA Scores 3MCR Scores 1 MCR Scores 2 MCR Scores 3

MCR resolves the original images unambiguously!(c) C

rown Copyright 2008

Page 60: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 60

©C

row

n C

opyr

ight

200

8

MCR summary

• MCR describes the original data using factors, consisting of loadingsand scores which which resembles chemical spectra and contributions from a multi-component mixture, respectively

• MCR uses an iterative algorithm to extract solutions, while applying suitable constraints e.g. non-negativity

• Good initial estimates and suitable data preprocessing are essential

• MCR is excellent for identification and localisation of chemicals in complex mixtures and allows for direct interpretation

Data matrix

Projection of samplesonto factors (scores matrix)

Projection of variablesonto factors (loadings matrix)

Residuals (noise)

EPTX +′=

I = no. of samplesK = no. of mass unitsN = no. of factors

(c) Crown Copyright 2008

Page 61: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 61

©C

row

n C

opyr

ight

200

8

Contents

1. Introduction2. Linear algebra3. Factor analysis4. Multivariate regression

• Multiple linear regression (MLR)• Principal component regression (PCR)• Partial least squares regression (PLS)• PLS Examples• Calibration, validation and prediction

5. Classification6. Conclusion

(c) Crown Copyright 2008

Page 62: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 62

©C

row

n C

opyr

ight

200

8

Data analysis

SIMS DatasetSIMS

Dataset

How is it related to known properties?

Where are they located?

What chemicalsare on the surface?

Calibration / Quantification

Classification

Identification

Can we predictthese properties?

Which group does it belong to?

Is there an outlierin the data?(c) C

rown Copyright 2008

Page 63: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 63

©C

row

n C

opyr

ight

200

8

Regression analysis

Mass spectrum of Sample 1

010203040

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Sample 2

0

10

20

30

1 2 3 4 5Mass

Inte

nsity

Mass spectrum of Sample 3

010203040

1 2 3 4 5Mass

Inte

nsity

6

4

1

Molecular weight

41Sample 3

72Sample 2

35Sample 1

Concentrationratio

XPS measurement

Measured properties

Can we predict the properties of similar materials from their SIMS spectra?

( )exbxbxbxby

efy

mm +++++=+=

...332211

x

‘Response’ variablei.e. measured property

‘Predictor’ variablei.e. intensity at mass m

Regressioncoefficient

(c) Crown Copyright 2008

Page 64: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 64

©C

row

n C

opyr

ight

200

8

Multiple linear regression (MLR)

• Extending to I samples and M response variables

EXBY +=

Responsevariables

SIMSdata matrix

Regressionmatrix

Residuals (noise)

)())(()( MIMKKIMI ×+××=×

I = no. of samplesK = no. of mass unitsM = no. of response variables

This is the covariance matrix of X! In SIMS this is likely to be close to singular and a well defined inverse matrix cannot be found. This is due to the problem of collinearity, caused by linearly dependentrows or columns in the matrix.

• Least squares solution (MLR solution)

( ) YXXXB ′′= −1YXB += or( ) XXXX ′′=+ −1

is the pseudoinverse of X

(c) Crown Copyright 2008

Page 65: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 65

©C

row

n C

opyr

ight

200

8

MLR - graphical representation EXBY +=

Responsevariables

SIMSdata matrix

Regressionmatrix

Residuals

We relate Y to the projection of X onto B –

MLR finds the least squares solution that minimises E i.e. the best R2 correlationbetween Y and the projections of data onto the regression vector XB

A. M. C. Davies, T. Fearn, Spectroscopy Europe 17 (2005) 28

Large number of correlated variables (e.g. mass) → Risk of overfitting!(c) C

rown Copyright 2008

Page 66: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 66

©C

row

n C

opyr

ight

200

8

Principal component regression (PCR)

• PCA reduces dimensionality of data and reduces effect of noise• PCA scores matrix is the coordinates of data points in reduced

factor space• Hence we can use PCA scores matrix T in our linear regression

( ) YTTTBYTB

′′=

+=−1

I = no. of samplesN = no. of PCA factorsM = no. of response variables

ETBY +=

Responsevariables PCA Scores

MatrixRegression

matrix

Residuals

( ) )()()( MIMNNIMI ×+××=×

These are now guaranteed to be invertible since the rows of PCA scores matrix are orthogonal(c) C

rown Copyright 2008

Page 67: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 67

©C

row

n C

opyr

ight

200

8

PCR – graphical representation

A. M. C. Davies, T. Fearn, Spectroscopy Europe 17 (2005) 28

One factor PCR example –PCR finds correlation between Y and projection of data onto first PCA factor (scores T).

For more than one factor, PCR finds linear combinations of scores Ton each PCA factor that are best for predicting Y

EΤBY +=Responsevariables

PCA scoresmatrix

Regressionmatrix

Residuals

Important to determine appropriate number of factors to include in PCR model(c) Crown Copyright 2008

Page 68: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 68

©C

row

n C

opyr

ight

200

8

Partial least squares regression (PLS)

The problem with PCR

• PCR uses PCA scores T are computed to model variations in X only!• By choosing directions that maximise the variance in data X we hope to

include important information which relates the original variables to Y• First few PCA factors of X may contain only matrix, topographical or other

effects, and may have no relation to quantities Y which we want to predict

X = SIMS data matrixY = Response variables

Introducing PLS!

• PLS extracts scores T that are common to both X and Y, using simultaneous decomposition of X and Y

• It finds factors describing large amounts of covariance between X and Y• It removes redundant information from the regression i.e. factors describing X

that has no correlation with Y• More viable, robust solution using fewer number of factors(c) C

rown Copyright 2008

Page 69: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 69

©C

row

n C

opyr

ight

200

8

PLS (NIPALS) algorithm

For decomposition of single matrix X in PCA, NIPALS calculate t1 and p1alternately until convergence. The next set of factors t2 and p2 are calculated by fitting the residuals (data not explained by p1)

From E. Malinowski, Factor Analysis in Chemistry, John Wiley and Sons (2002)

(1) PCA decomposition

Xt

p’

)( KI ×

)1( ×I

)1( K×

(2) PLS decomposition

For simultaneous decomposition of X and Y, PLS finds a mutual set of scores common to X and Y so tx = ty

tX = tY

Y

q’p’ )1( K×

X)( KI ×

)1( M×

)( MI ×

)1( ×I

I = no. of samplesK = no. of mass unitsM = no. of response variablesN = no. of PCA factors

(c) Crown Copyright 2008

Page 70: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 70

©C

row

n C

opyr

ight

200

8

We can now write

PLS formulation

• W is the weights matrix and reflects covariance structure between X and Y• T are PLS scores used to predict Y from X. Columns of T are orthogonal.• P and Q are not orthogonal matrices due to constraint on finding common

scores T. They are sometimes called ‘x-loadings’ and ‘y-loadings’ respectively

• In literature ‘latent variable’ refers to the set of quantities t, p and qassociated with each PLS factor

FQTYEPTX+′=+′=

scores residuals

EXBY +=( ) QWQPYXB ′=′+′=+=

regression matrix weights matrix

X = SIMS data matrixY = Response variables

(c) Crown Copyright 2008

Page 71: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 71

©C

row

n C

opyr

ight

200

8

0 1 2 3 4 5 60

1

2

3

4

5

6

Thickness measured by XPS (nm)

Thic

knes

s pr

edic

ted

by S

IMS

(nm

)

PLS example (1)

• SIMS spectra of thin films of Irganox were compared with their thicknesses measured with XPS

• Two PLS factors are retained, explaining 99.8% of the variance in X (SIMS data) and 98.8% of the variance in Y (thicknesses)

• PLS model able to predict thicknesses for t < 6 nm

• PLS regression vector shows us the SIMS peaks most correlated with thickness

200 400 600 800 1000 1200-2

0

2

4

6

8

10

12x 1010

Mass, u

Reg

ress

ion

Vec

tor f

or Y

231

1176

59

277(c) Crown Copyright 2008

Page 72: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 72

©C

row

n C

opyr

ight

200

8

PLS example (2)

A. J. Urquhart et al., Anal. Chem., 80 (1), 135 -142, 2008

• ToF-SIMS spectra of 576 copolymers are related to their experimental water contact angles (WCA)

• Positive and negative ion spectra are normalised separately, then concatenated (combined) into single data matrix X

Polar speciese.g. CnHmO+ & CN-

hydrophilic

Hydrocarbonse.g. CnHm

+

hydrophobic

(c) Crown Copyright 2008

Page 73: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 73

©C

row

n C

opyr

ight

200

8

PLS validation

• PLS can be used to build predictive models (calibration)• Validation is needed to guard against over-fitting• Without enough data for validation set, cross validation can be useful

0

5

10

15

20

25

30

35

0 10 20 30Predictor variable, X

Res

pons

e va

riabl

e, Y

05

1015202530354045

0 10 20 30Predictor variable, X

Res

pons

e va

riabl

e, Y

Good predictive model Data is overfitted!

(c) Crown Copyright 2008

Page 74: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 74

©C

row

n C

opyr

ight

200

8

1 2 3 4 5 6 7 8 9 10 11 120

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Number of PLS Factors

RM

SE

CV

, RM

SE

C

RMSECVRMSEC

PLS validation

• ‘Leave one out’ cross validation most popular– Calculate PLS model excluding sample i– Predict sample i and calculate error– Repeat for all different samples– Calculate root mean square error of cross validation (RMSECV)

RMSEC (Root Mean Square Error of Calibration) goes down with increasing number of factors

To decide optimal number of factors use minimum of RMSECV(Root Mean Square Error of Cross Validation) or PRESS (Prediction Residual Sum of Squares)(c) C

rown Copyright 2008

Page 75: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 75

©C

row

n C

opyr

ight

200

8

PLS validation

• If dataset is large enough, split into calibration and validation sets• Rule of thumb – 2/3 calibration set, 1/3 validation set• Validation data should be statistically independent from calibration data

i.e. NOT repeat spectra of same sample!

sample

populationcalibration

validationnext set ofsample?

Calibration

Validation

Prediction

Independent validation set is essential if we want to use model to predict new samples!(c) C

rown Copyright 2008

Page 76: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 76

©C

row

n C

opyr

ight

200

8

PLS summary

• PLS is a multivariate linear regression technique

• PLS decomposes matrices X (predictors) and Y (responses) simultaneously, in order to find factors that best describe the structure of covariance between X and Y

• Data preprocessing method needs to be selected with care

• PLS is excellent for calibration and quantification, and for studying the relationship between SIMS data and other measured properties

• Properly validated PLS models can be used for predictions of these properties using SIMS data

EXBY +=Responsevariables

Data matrix Regressionmatrix

Residuals (noise)

(c) Crown Copyright 2008

Page 77: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 77

©C

row

n C

opyr

ight

200

8

Contents

1. Introduction2. Linear algebra3. Factor analysis4. Multivariate regression5. Classification

• PCA classification• PC-DFA• PLS-DA

• Conclusion

(c) Crown Copyright 2008

Page 78: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 78

©C

row

n C

opyr

ight

200

8

Data analysis

SIMS DatasetSIMS

Dataset

How is it related to known properties?

Where are they located?

What chemicalsare on the surface?

Calibration / Quantification

Classification

Identification

Can we predictthese properties?

Which group does it belong to?

Is there an outlierin the data?(c) C

rown Copyright 2008

Page 79: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 79

©C

row

n C

opyr

ight

200

8

PCA classification (1)

• 16 different single protein films adsorbed on mica

• Excellent classification of proteins using only 2 factors

• Factors consistent with total amino acid composition of various proteins

• 95% confidence limits provide means for identification / classification

M. Wagner & D. G. Castner, Langmuir, 17 (2001) 4649

PC

2 S

core

s (1

9%)

PC1 Scores (53%)

PC

A L

oadi

ngs

(c) Crown Copyright 2008

Page 80: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 80

©C

row

n C

opyr

ight

200

8

PCA classification (2)

• Octadecanethiol self-assembled monolayers on gold substrates, exposed to different allylamine plasma deposition times

• Four clusters of objects are observed when the scores are on different PCA factors are plotted

• Magnification of framed cluster reveals further clustering

• Outliers can also be located

M. Von Gradowski et al, Surf. Interface Anal. 36 (2004) 1114

(c) Crown Copyright 2008

Page 81: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 81

©C

row

n C

opyr

ight

200

8

• PC-DFA = “Principal Component – Discriminant Function Analysis”• ‘Discriminant functions’ maximizes the Fisher’s ratio between groups

• Used to distinguish strains of bacteria

PC-DFA

( )21

221ratio sFisher'

varvarmeanmean+−

=

J. S. Fletcher et al, Appl. Surf. Sci. 252 (2006) 6869

(c) Crown Copyright 2008

Page 82: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 82

©C

row

n C

opyr

ight

200

8

PLS-DA

• Partial Least Squares Discriminant Analysis• PLS finds factors that describes the biggest

co-variance between the data X and the group assignments (e.g. 0 and 1) Y.

• Regression vector shows linear combination of peaks that maximally distinguishes epidermal and other cells

Decluttered

50 100 150 200 250 300 350-0.2

-0.15

-0.1

-0.05

0

0.05

0.1

0.15

Variable

Reg

Vec

tor f

or Y

1

3 4 5 9 11 16 17 19 22 23 24 27 31 32 33

37

38

39

40 42

44

45 50 53 54

55

57

60 61 62 65 67

71

72 74

76

77 79 81 84

86 87 89

91

92

93 94

95

96

97 98 103

104

105 108

109

111

113

114

118 119

123 126

129

131

132

135 136 139 141 144

145

147

149

151 154

157

158

163

164 169

170

171

172

173

175

177

179 182 183

184 187 191 195 197 198 199 200 208 209

212

213

214

215

217 219 225

226 230 233

235 238 243 246

249 251 254

255

257 259 263 267

274 276

278 284 288 290 292

298 300 308 314

316 317

325 326

330 333 339 341

344 349 350

Variables/Loadings Plot for data

Samples/Scores Plot of data

20 40 60 80 100 120

20

40

60

80

100

120-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Image courtesy of Prof C. R. M. Grovenor at the University of Oxford

trichome

epidermal

mesophyll

(c) Crown Copyright 2008

Page 83: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 83

©C

row

n C

opyr

ight

200

8

Classification summary

• PCA allows for quick grouping of samples based on their similarities• PC-DFA and PLS-DA are supervised classification methods – prior knowledge

about groups are required• Properly validated classification models are needed for predictions• There also exists unsupervised clustering methods, e.g. hierarchal cluster

analysis, K-nearest-neighbours, artificial neural networks…..

design

retrieval

analysis dissemination

visualisation

usecreation

organisation

management

chemical informationchemical

information

All these (and much, much more) belong to thewider field of chemoinformatics!

(c) Crown Copyright 2008

Page 84: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 84

©C

row

n C

opyr

ight

200

8

Data analysis

SIMS DatasetSIMS

Dataset

How is it related to known properties?

Where are they located?

What chemicalsare on the surface?

Calibration / Quantification

Identification

Can we predictthese properties?

PCA, MCR

PCR, PLS

ClassificationWhich group does it belong to?

Is there an outlierin the data?

PC-DFA, PLS-DA

(c) Crown Copyright 2008

Page 85: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 85

©C

row

n C

opyr

ight

200

8

Multivariate analysissummary

J L S Lee, I S Gilmore, “The application of multivariate data analysis techniques in surface analysis”, inSurface Analysis: The Principal Techniques 2nd edition(eds J C Vickerman, I S Gilmore), Wiley.

(c) Crown Copyright 2008

Page 86: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 86

©C

row

n C

opyr

ight

200

8

Conclusion

In this tutorial we have looked at– Identification using PCA and MCR– Quantification using MLR, PCR and PLS– Classification using PC-DFA, PLS-DA– Importance of validation for predictive models– Data preprocessing techniques and their effects– Matrix and vector algebra– Newly defined multivariate analysis terminology

Terms Here Symbol Definition PCA MCR PLS

Factor - An axis in the data space representing an underlying dimension that contributes to summarising or accounting for the original data set

Principal Component

Pure Component

Latent Vectors, Latent

Variables

Loadings P Correlation between the original variables and the factors

Loadings, Eigenvector

Component Spectrum Loadings

Scores T Projection of the samples onto the factors

Scores, Projections

Component Concentration Scores

(c) Crown Copyright 2008

Page 87: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 87

©C

row

n C

opyr

ight

200

8

Bibliography

General• J. L. S. Lee et al, “The application of multivariate data analysis techniques in surface analysis”, in Surface Analysis: The

Principal Techniques 2nd edition (eds J C Vickerman, I S Gilmore), Wiley.• S. Wold, Chemometrics; what do we mean with it, and what do we want from it?, Chemom. Intell. Lab. Syst. 30 (1995) 109• E. R. Malinowski, Factor analysis in Chemistry, John Wiley and Sons (2002)• P. Geladi et al, Multivariate image analysis, John Wiley and Sons (1996)• J. L. S. Lee et al, Quantification and methodology issues in multivariate analysis of ToF-SIMS data for mixed organic systems,

Surf. Interface Anal. 40 (2008) 1• D. J. Graham, NESAC/BIO ToF-SIMS MVA web resource, http://nb.engr.washington.edu/nb-sims-resource/

PCA• D. J. Graham et al, Information from complexity: challenges of ToF-SIMS data interpretation, Appl. Surf. Sci. 252 (2006) 6860• M. R. Keenan et al, Accounting for Poisson noise in the multivariate analysis of ToF-SIMS spectrum images, Surf. Interface

Anal. 36 (2004) 203• M. R. Keenan et al, Mitigating dead-time effects during multivariate analysis of ToF-SIMS spectral images, Surf. Interface Anal.

40 (2008) 97

MCR• N. B. Gallagher et al, Curve resolution for multivariate images with applications to TOF-SIMS and Raman, Chemom. Intell.

Lab. Syst. 73 (2004) 105• J. A. Ohlhausen et al, Multivariate statistical analysis of time-of-flight secondary ion mass spectrometry using AXSIA, Appl.

Surf. Sci. 231-232 (2004) 230• R. Tauler, A. de Juan, MCR-ALS Graphic User Friendly Interface, http://www.ub.edu/mcr/PLS• P. Geladi et al, Partial Least-Squares Regression: A Tutorial, Analytica Chimica Acta 185 (1986) 1• A. M. C. Davies et al, Back to basics: observing PLS, Spectroscopy Europe 17 (2005) 28

(c) Crown Copyright 2008

Page 88: A Guide to the Practical Use of Chemometrics - with ...resource.npl.co.uk/.../environmental/practical_chemometrics_guide_2… · Multivariate analysis • Analysis involving a simultaneous

Slide 88

©C

row

n C

opyr

ight

200

8

Acknowledgements

The work is supported by UK Department of Innovation, Universities and Skills (DIUS)’s Chemical and Biological Metrology Programme

For further information of Surface andNanoanalysis at NPL please visithttp://www.npl.co.uk/nanoanalysis

We would like to thank Dr Ian Fletcher (Intertek MSG) and Prof Chris Grovenor (University of Oxford) for images, and Dr Martin Seah (NPL) for helpful comments

(c) Crown Copyright 2008