predict.osc {mt} | R Documentation |
Predict Method for Class 'osc'
Description
Pre-processing of new data by osc
.
Usage
## S3 method for class 'osc'
predict(object, newdata,...)
Arguments
object |
Object of class |
newdata |
A matrix or data frame of cases to be corrected by OSC. |
... |
Arguments based from or to other methods. |
Details
This function is a method for the generic function predict()
for
class osc
. If newdata
is omitted, the corrected data set used in model of
osc
will be returned.
Value
A list containing the following components:
x |
A matrix of OSC corrected data set. |
Q2 |
The fraction of variation in X after OSC correction for the new data. |
Author(s)
Wanchang Lin
See Also
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="wold",osc.ncomp=2, pls.ncomp=4)
names(res)
res
summary(res)
## pre-process test data by OSC
test <- predict(res,test.dat)
test.dat.1 <- test$x
[Package mt version 2.0-1.20 Index]