R: Wrapper function for als, plus some support functions
doALS
R Documentation
Wrapper function for als, plus some support functions
Description
Wrapper function for the als function in the ALS
package, providing a simple interface with sensible defaults for
hyphenated data.
Usage
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.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(alsace)
Loading required package: ALS
Loading required package: nnls
Loading required package: Iso
Iso 0.0-17
Loading required package: ptw
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/alsace/doALS.Rd_%03d_medium.png", width=480, height=480)
> ### Name: doALS
> ### Title: Wrapper function for als, plus some support functions
> ### Aliases: doALS print.ALS plot.ALS summary.ALS getTime getWavelength
> ### Keywords: manip
>
> ### ** Examples
>
> 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
ALS object fitting 5 samples; RMS fit error 0.16252
> summary(Xl.als)
ALS object fitting 5 samples with 4 components.
Each data matrix contains 121 wavelengths and 60 timepoints
RMS fit error: 0.16252
LOF: 2.13%
R2: 0.99955
> plot(Xl.als, "spectra")
> par(mfrow = c(1, 3))
> plot(Xl.als, "profiles", ylim = c(0, 600), mat.idx = 1:3)
>
>
>
>
>
> dev.off()
null device
1
>