Description Usage Arguments Details Value Author(s) References See Also Examples
The function mrpls
performs prediction using Fort and Lambert-Lacroix (2005) RPLS
algorithm.
1 |
Xtrain |
a (ntrain x p) data matrix of predictors. |
Ytrain |
a ntrain vector of responses. |
Xtest |
a (ntest x p) matrix containing the predictors for the test data
set. |
Lambda |
a positive real value. |
ncomp |
a positive integer. |
NbIterMax |
a positive integer. |
The columns of the data matrices Xtrain
and Xtest
may not be standardized,
since standardizing is performed by the function rpls
as a preliminary step
before the algorithm is run.
The procedure described in Fort and Lambert-Lacroix (2005) is used to determine
latent components to be used for classification and when Xtest
is not equal to NULL, the procedure predicts the labels for these new
predictor variables.
A list with the following components:
Ytest |
the ntest vector containing the predicted labels for the observations from
|
Coefficients |
the (p+1) vector containing the coefficients weighting the design matrix. |
DeletedCol |
the vector containing the column number of |
hatY |
If |
Sophie Lambert-Lacroix (http://membres-timc.imag.fr/Sophie.Lambert/).
G. Fort and S. Lambert-Lacroix (2005). Classification using Partial Least Squares with Penalized Logistic Regression, Bioinformatics, vol 21, n 8, 1104-1111.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # load plsgenomics library
library(plsgenomics)
# load Colon data
data(Colon)
IndexLearn <- c(sample(which(Colon$Y==2),12),sample(which(Colon$Y==1),8))
# preprocess data
res <- preprocess(Xtrain= Colon$X[IndexLearn,], Xtest=Colon$X[-IndexLearn,],
Threshold = c(100,16000),Filtering=c(5,500),
log10.scale=TRUE,row.stand=TRUE)
# the results are given in res$pXtrain and res$pXtest
# perform prediction by RPLS
resrpls <- rpls(Ytrain=Colon$Y[IndexLearn],Xtrain=res$pXtrain,Lambda=0.6,ncomp=1,Xtest=res$pXtest)
resrpls$hatY
sum(resrpls$Ytest!=Colon$Y[-IndexLearn])
# prediction for another sample
Xnew <- res$pXtest[1,]
# Compute the linear predictor for each classes expect class 0
eta <- c(1,Xnew) %*% resrpls$Coefficients
Ypred <- which.max(c(0,eta))
Ypred
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.