components: Functions to assess and refine ALS components

Description Usage Arguments Details Value Author(s) Examples

Description

One of the inherent drawbacks of the MCR-ALS method is that in the vast majority of cases there is no one unique set of components describing the data, a situation known as "rotational ambiguity". This implies that in some cases a spectrum of a chemical compound can be described by a linear combination of two ALS components. This can sometimes be recognised by looking at elution profiles. In addition, in cases where the number of components is too large, some components may only describe noise or very small and irrelevant features. The functions clarified here allow one to find which components only correspond with minor features, to remove components, and to merge components.

Usage

1
2
3
4
5
smallComps(obj, Ithresh)
removeComps(obj, toRemove, ...)
combineComps(obj, compList, weights, ...)
suggestCompCombis(obj, indices, Ithresh = 0, corthresh = 0.9,
                  clusterHeight = 0.6)

Arguments

obj

The R object containing the als model

Ithresh

Intensity cutoff: all components with a maximal intensity (in the elution profiles) below this value will be termed "small".

toRemove

The indices of the components to remove from the ALS model. A new call to doALS will be done with the smaller set of components.

...

Additional arguments to doALS, e.g. maxiter = 1 if no full set of iterations is required.

compList

A list indicating which components need to be combined. Using list(c(1, c(2, 3), 4)) will lead to a three-component model, where components 1 and 4 are unchanged and components 2 and 3 are combined.

weights

Weights for the components to be combined. If not provided, equal weights will be assumed.

indices

A list indicating in which (groups of) samples correlations will be calculated. See details.

corthresh

Correlation threshold: components with elution profiles showing a higher correlation than this threshold may be candidates for merging.

clusterHeight

Similarity threshold at which to cut the dendrogram (see details).

Details

Function suggestCompCombis checks correlations in elution profiles that could point to a situation where one chemical compound is described by two or more ALS components. For every sample in which this correlation is higher than the threshold, a "hit" will be recorded for these two components. After checking all samples and all combinations, the hit matrix will be used as a similarity measure in a hierarchical clustering. The dendrogram will be cut at a specific height, leading to groups of components, sometimes containing more than one element. In such a case, these components could be considered for merging.

If injections of pure standards are present, they probably should not be used in isolation to check for coelution; rather, suggestions for combined components can be validated looking at the elution profiles of the standards.

Value

Functions removeComps and combineComps return ALS objects with fewer components than the original object. Function smallComps returns a list of two elements:

smallComps

the indices of the small components

maxCvalues

the maximal values found in the concentration profiles across all samples for each of the components.

Author(s)

Ron Wehrens

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
data(tea)
new.lambdas <- seq(260, 500, by = 2)
tea <- lapply(tea.raw, preprocess)
tea.split <- splitTimeWindow(tea, c(12, 14), overlap = 10)

Xl <- tea.split[[3]]
Xl.opa <- opa(Xl, 10)

Xl.als <- doALS(Xl, Xl.opa)
smallC <- smallComps(Xl.als, 5)
smallC

Xl.als2 <- removeComps(Xl.als, smallC$smallC)
summary(Xl.als)
summary(Xl.als2)
## smaller models, but with a higher fit error...

## another way to decrease the number of components, this example
## not particularly deep, just to show how it can be done:
Xl.als3 <- combineComps(Xl.als, list(1, 2, 3:4, 5, c(6, 10), 6, 7:9))
summary(Xl.als3)

Example output

Loading required package: ALS
Loading required package: nnls
Loading required package: Iso
Iso 0.0-17
Loading required package: ptw
There were 50 or more warnings (use warnings() to see the first 50)
$smallComps
Component 5 Component 6 Component 8 
          5           6           8 

$maxCvalues
 Component 1  Component 2  Component 3  Component 4  Component 5  Component 6 
    5.655070   353.613378   437.364245    19.930027     4.284987     3.054079 
 Component 7  Component 8  Component 9 Component 10 
    6.727300     3.909809     8.156879    17.170391 

ALS object fitting 5 samples with 10 components. 
Each data matrix contains 209 wavelengths and 30 timepoints
	RMS fit error: 0.02231 
	LOF: 0.19%
	R2: 1
ALS object fitting 5 samples with 7 components. 
Each data matrix contains 209 wavelengths and 30 timepoints
	RMS fit error: 0.05161 
	LOF: 0.44%
	R2: 0.99998
Warning messages:
1: In xx/sqrt(crossprod(xx)) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

2: In xx/sqrt(crossprod(xx)) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

3: In xx/sqrt(crossprod(xx)) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

4: In xx/sqrt(crossprod(xx)) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

5: In xx/sqrt(crossprod(xx)) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

6: In xx/sqrt(crossprod(xx)) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

7: In xx/sqrt(crossprod(xx)) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

ALS object fitting 5 samples with 7 components. 
Each data matrix contains 209 wavelengths and 30 timepoints
	RMS fit error: 0.05241 
	LOF: 0.45%
	R2: 0.99998

alsace documentation built on Nov. 8, 2020, 5:54 p.m.