osc {mt} | R Documentation |
Orthogonal Signal Correction (OSC)
Description
Data pre-processing by orthogonal signal correction (OSC).
Usage
osc(x, ...)
## Default S3 method:
osc(x, y, method="wold",center=TRUE,osc.ncomp=4,pls.ncomp=10,
tol=1e-3, iter=20,...)
## S3 method for class 'formula'
osc(formula, data = NULL, ..., subset, na.action = na.omit)
Arguments
formula |
A formula of the form |
data |
Data frame from which variables specified in |
x |
A matrix or data frame containing the explanatory variables if no formula is given as the principal argument. |
y |
A factor specifying the class for each observation if no formula principal argument is given. |
method |
A method for calculating OSC weights, loadings and scores. The following methods are supported:
|
center |
A logical value indicating whether the data set should be centred by column-wise. |
osc.ncomp |
The number of components to be used in the OSC calculation. |
pls.ncomp |
The number of components to be used in the PLS calculation. |
tol |
A scalar value of tolerance for OSC computation. |
iter |
The number of iteration used in OSC calculation. |
... |
Arguments passed to or from other methods. |
subset |
An index vector specifying the cases to be used in the training sample. |
na.action |
A function to specify the action to be taken if |
Value
An object of class osc
containing the following components:
x |
A matrix of OSC corrected data set. |
R2 |
R2 statistics. It is calculated as the fraction of variation in X after OSC correction for the calibration (training) data. |
angle |
An angle used for checking if scores |
w |
A matrix of OSC weights. |
p |
A matrix of OSC loadings. |
t |
A matrix of OSC scores. |
call |
The (matched) function call. |
center |
A logical value indicating whether the data set has been centred by column-wise. |
osc.ncomp |
The number of component used in OSC computation. |
pls.ncomp |
The number of component used in PLS computation. |
method |
The OSC algorithm used. |
Note
This function may be called giving either a formula and optional data frame, or a matrix and grouping factor as the first two arguments.
Author(s)
Wanchang Lin
References
Wold, S., Antti, H., Lindgren, F., Ohman, J.(1998). Orthogonal signal correction of near infrared spectra. Chemometrics Intell. Lab. Syst., 44: 175-185.
Westerhuis, J. A., de Jong, S., Smilde, A, K. (2001). Direct orthogonal signal correction. Chemometrics Intell. Lab. Syst., 56: 13-25.
Sjoblom. J., Svensson, O., Josefson, M., Kullberg, H., Wold, S. (1998). An evaluation of orthogonal signal correction applied to calibration transfer of near infrared spectra. Chemometrics Intell. Lab. Syst.,44: 229-244.
Svensson, O., Kourti, T. and MacGregor, J.F. (2002). An investigation of orthogonal correction algorithms and their characteristics. Journal of Chemometrics, 16:176-188.
Wise, B. M. and Gallagher, N.B. http://www.eigenvector.com/MATLAB/OSC.html.
See Also
predict.osc
, osc_wold
, osc_sjoblom
,
osc_wise
Examples
data(abr1)
cl <- factor(abr1$fact$class)
dat <- abr1$pos
## divide data as training and test data
idx <- sample(1:nrow(dat), round((2/3)*nrow(dat)), replace=FALSE)
## construct train and test data
train.dat <- dat[idx,]
train.t <- cl[idx]
test.dat <- dat[-idx,]
test.t <- cl[-idx]
## build OSC model based on the training data
res <- osc(train.dat, train.t, method="wise", osc.ncomp=2, pls.ncomp=4)
names(res)
res
summary(res)
## pre-process test data by OSC
test.dat.1 <- predict(res,test.dat)$x