doALS: Wrapper function for als, plus some support functions

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/doALS.R

Description

Wrapper function for the als function in the ALS package, providing a simple interface with sensible defaults for hyphenated data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
doALS(Xl, PureS, maxiter = 100)
## S3 method for class 'ALS'
print(x, ...)
## S3 method for class 'ALS'
summary(object, ...)
## S3 method for class 'ALS'
plot(x, what = c("spectra", "profiles"), showWindows = TRUE,
                   mat.idx, comp.idx, xlab, ylab, main, ...)
getTime(x)
getWavelength(x)

Arguments

Xl

a list of (numerical) data matrices. Missing values are not allowed.

x, object

an object of class ALS.

PureS

Initial estimates of pure spectral components.

maxiter

maximum number of iterations in ALS.

what

Show spectra or elution profiles

showWindows

If showing elution profiles, the window borders and the overlap areas between the windows can be shown (by default). Simply set this parameter to FALSE if this is undesired.

mat.idx

If showing elution profiles, one can provide the index of the sample(s) that should be shown. For every sample one plot will be made. Default is to show all.

comp.idx

Indices of components to be shown. Default is to show all components.

xlab, ylab, main, ...

self-explanatory optional arguments

Details

The plot method can be used to plot the spectral components (one plot for the model) or the elution profiles (one plot for each data matrix, so usually several plots). The summary method also returns fit statistics like LOF, R2 and RMS. Extractor functions getTime and getWavelength provide the vectors of time points and wavelengths from the ALS object.

Value

Function doALS returns an object of class "ALS", a list with the following fields:

CList

a list of matrices with the elution profiles in the columns. Every matrix in this list corresponds with a matrix in the input.

S

a matrix with the spectral components in the columns. These are common for all data matrices.

rss

residual sum of squares.

resid

a list of residual matrices.

iter

number of iterations.

summ.stats

summary statistics, providing more information about the fit quality.

See the als function for more details; only the summ.stats field is not part of the original als output.

Author(s)

Ron Wehrens

See Also

als,showALSresult

Examples

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

Xl <- tea.split[[2]]
Xl.opa <- opa(Xl, 4)

Xl.als <- doALS(Xl, Xl.opa)
Xl.als
summary(Xl.als)
plot(Xl.als, "spectra")
par(mfrow = c(1, 3))
plot(Xl.als, "profiles", ylim = c(0, 600), mat.idx = 1:3)

rwehrens/alsace documentation built on May 28, 2019, 10:42 a.m.