pls {fastPLS} | R Documentation |
Partial Least Squares.
Description
Partial Least Squares (PLS) classification and regression for test set from training set.
Usage
pls (Xtrain,
Ytrain,
Xtest = NULL,
Ytest = NULL,
ncomp=min(5,c(ncol(Xtrain),nrow(Xtrain))),
scaling = c("centering", "autoscaling","none"),
method = c("plssvd", "simpls"),
svd.method = c("irlba", "dc"),
fit = FALSE,
proj = FALSE,
perm.test = FALSE,
times = 100)
Arguments
Xtrain |
a matrix of training set cases. |
Ytrain |
a classification vector. |
Xtest |
a matrix of test set cases. |
Ytest |
a classification vector. |
ncomp |
the number of components to consider. |
scaling |
the scaling method to be used. Choices are " |
method |
the algorithm to be used to perform the PLS. Choices are " |
svd.method |
the SVD method to be used to perform the PLS. Choices are " |
fit |
a boolean value to perform the fit. |
proj |
a boolean value to perform the fit. |
perm.test |
a classification vector. |
times |
a classification vector. |
Value
A list with the following components:
B |
the (p x m x length(ncomp)) matrix containing the regression coefficients. Each row corresponds to a predictor variable and each column to a response variable. The third dimension of the matrix B corresponds to the number of PLS components used to compute the regression coefficients. If ncomp has length 1, B is just a (p x m) matrix. |
Q |
the (m x max(ncomp)) matrix containing the Y-loadings. |
Ttrain |
the (ntrain x max(ncomp)) matrix containing the X-scores (latent components) |
R |
the (p x max(ncomp)) matrix containing the weights used to construct the latent components. |
mX |
mean X. |
vX |
variance X. |
mY |
mean Y. |
p |
matrix for the independent variable X. This indicates how the original data relates to the latent components. |
m |
number of predictor variables |
ncomp |
number of components used in the PLS model |
Yfit |
the prediction values based on the PLS model |
R2Y |
proportion of variance in Y |
classification |
a boolgean output is given indicating if the response variable is a classification |
lev |
level of response variable Y |
Ypred |
the (ntest x m x length(ncomp)) containing the predicted values of the response variables for the observations from Xtest. The third dimension of the matrix Ypred corresponds to the number of PLS components used to compute the regression coefficients. |
P |
the (p x max(ncomp)) matrix containing the X-loadings. |
Ttest |
... |
Author(s)
Dupe Ojo, Alessia Vignoli, Stefano Cacciatore, Leonardo Tenori
See Also
Examples
data(iris)
data=iris[,-5]
labels=iris[,5]
ss=sample(150,15)
ncomponent=3
z=pls(data[-ss,], labels[-ss], data[ss,], ncomp=ncomponent)