Description Usage Arguments Details Value Note Author(s) References See Also Examples
This function implements Partial least squares Regression models with leave one out cross validation for complete or incomplete datasets.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  plsR(x, ...)
## Default S3 method:
plsRmodel(dataY, dataX, nt = 2, limQ2set = 0.0975,
dataPredictY = dataX, modele = "pls", family = NULL, typeVC = "none",
EstimXNA = FALSE, scaleX = TRUE, scaleY = NULL, pvals.expli = FALSE,
alpha.pvals.expli = 0.05, MClassed = FALSE, tol_Xi = 10^(12), weights,
sparse = FALSE, sparseStop = TRUE, naive = FALSE,verbose=TRUE)
## S3 method for class 'formula'
plsRmodel(formula, data, nt = 2, limQ2set = 0.0975,
dataPredictY, modele = "pls", family = NULL, typeVC = "none",
EstimXNA = FALSE, scaleX = TRUE, scaleY = NULL, pvals.expli = FALSE,
alpha.pvals.expli = 0.05, MClassed = FALSE, tol_Xi = 10^(12), weights,
subset, contrasts = NULL, sparse = FALSE, sparseStop = TRUE, naive = FALSE,
verbose=TRUE)
PLS_lm(dataY, dataX, nt = 2, limQ2set = 0.0975, dataPredictY = dataX,
modele = "pls", family = NULL, typeVC = "none", EstimXNA = FALSE,
scaleX = TRUE, scaleY = NULL, pvals.expli = FALSE,
alpha.pvals.expli = 0.05, MClassed = FALSE, tol_Xi = 10^(12),
weights,sparse=FALSE,sparseStop=FALSE,naive=FALSE,verbose=TRUE)
PLS_lm_formula(formula,data=NULL,nt=2,limQ2set=.0975,dataPredictY=dataX,
modele="pls",family=NULL,typeVC="none",EstimXNA=FALSE,scaleX=TRUE,
scaleY=NULL,pvals.expli=FALSE,alpha.pvals.expli=.05,MClassed=FALSE,
tol_Xi=10^(12),weights,subset,contrasts=NULL,sparse=FALSE,
sparseStop=FALSE,naive=FALSE,verbose=TRUE)

x 
a formula or a response (training) dataset 
dataY 
response (training) dataset 
dataX 
predictor(s) (training) dataset 
formula 
an object of class " 
data 
an optional data frame, list or environment (or object coercible by 
nt 
number of components to be extracted 
limQ2set 
limit value for the Q2 
dataPredictY 
predictor(s) (testing) dataset 
modele 
name of the PLS model to be fitted, only ( 
family 
for the present moment the family argument is ignored and set thanks to the value of modele. 
typeVC 
type of leave one out cross validation. Several procedures are available. If cross validation is required, one needs to selects the way of predicting the response for left out observations. For complete rows, without any missing value, there are two different ways of computing these predictions. As a consequence, for mixed datasets, with complete and incomplete rows, there are two ways of computing prediction : either predicts any row as if there were missing values in it (

EstimXNA 
only for 
scaleX 
scale the predictor(s) : must be set to TRUE for 
scaleY 
scale the response : Yes/No. Ignored since non always possible for glm responses. 
pvals.expli 
should individual pvalues be reported to tune model selection ? 
alpha.pvals.expli 
level of significance for predictors when pvals.expli=TRUE 
MClassed 
number of missclassified cases, should only be used for binary responses 
tol_Xi 
minimal value for Norm2(Xi) and det(pp'*pp) if there is any missing value in the 
weights 
an optional vector of 'prior weights' to be used in the fitting process. Should be 
subset 
an optional vector specifying a subset of observations to be used in the fitting process. 
contrasts 
an optional list. See the 
sparse 
should the coefficients of nonsignificant predictors (< 
sparseStop 
should component extraction stop when no significant predictors (< 
naive 
Use the naive estimates for the Degrees of Freedom in plsR? Default is 
verbose 
should info messages be displayed ? 
... 
arguments to pass to 
There are several ways to deal with missing values that leads to different computations of leave one out cross validation criteria.
A typical predictor has the form response ~ terms where response is the (numeric) response vector and terms is a series of terms which specifies a linear predictor for response. A terms specification of the form first + second indicates all the terms in first together with all the terms in second with any duplicates removed.
A specification of the form first:second indicates the the set of terms obtained by taking the interactions of all terms in first with all terms in second. The specification first*second indicates the cross of first and second. This is the same as first + second + first:second.
The terms in the formula will be reordered so that main effects come first, followed by the interactions, all secondorder, all thirdorder and so on: to avoid this pass a terms object as the formula.
NonNULL weights can be used to indicate that different observations have different dispersions (with the values in weights being inversely proportional to the dispersions); or equivalently, when the elements of weights are positive integers w_i, that each response y_i is the mean of w_i unitweight observations.
The default estimator for Degrees of Freedom is the Kramer and Sugiyama's one. Information criteria are computed accordingly to these estimations. Naive Degrees of Freedom and Information Criteria are also provided for comparison purposes. For more details, see N. Kraemer and M. Sugiyama. (2011). The Degrees of Freedom of Partial Least Squares Regression. Journal of the American Statistical Association, 106(494), 697705, 2011.
nr 
Number of observations 
nc 
Number of predictors 
nt 
Number of requested components 
ww 
raw weights (before L2normalization) 
wwnorm 
L2 normed weights (to be used with deflated matrices of predictor variables) 
wwetoile 
modified weights (to be used with original matrix of predictor variables) 
tt 
PLS components 
pp 
loadings of the predictor variables 
CoeffC 
coefficients of the PLS components 
uscores 
scores of the response variable 
YChapeau 
predicted response values for the dataX set 
residYChapeau 
residuals of the deflated response on the standardized scale 
RepY 
scaled response vector 
na.miss.Y 
is there any NA value in the response vector 
YNA 
indicatrix vector of missing values in RepY 
residY 
deflated scaled response vector 
ExpliX 
scaled matrix of predictors 
na.miss.X 
is there any NA value in the predictor matrix 
XXNA 
indicator of nonNA values in the predictor matrix 
residXX 
deflated predictor matrix 
PredictY 
response values with NA replaced with 0 
press.ind 
individual PRESS value for each observation (scaled scale) 
press.tot 
total PRESS value for all observations (scaled scale) 
family 
glm family used to fit PLSGLR model 
ttPredictY 
PLS components for the dataset on which prediction was requested 
typeVC 
type of leave one out crossvalidation used 
dataX 
predictor values 
dataY 
response values 
computed_nt 
number of components that were computed 
CoeffCFull 
matrix of the coefficients of the predictors 
CoeffConstante 
value of the intercept (scaled scale) 
Std.Coeffs 
Vector of standardized regression coefficients 
press.ind2 
individual PRESS value for each observation (original scale) 
RSSresidY 
residual sum of squares (scaled scale) 
Coeffs 
Vector of regression coefficients (used with the original data scale) 
Yresidus 
residuals of the PLS model 
RSS 
residual sum of squares (original scale) 
residusY 
residuals of the deflated response on the standardized scale 
AIC.std 
AIC.std vs number of components (AIC computed for the standardized model 
AIC 
AIC vs number of components 
optional 
If the response is assumed to be binary:

ttPredictFittedMissingY 
Description of 'comp2' 
optional 
If cross validation was requested:

InfCrit 
table of Information Criteria 
Std.ValsPredictY 
predicted response values for supplementary dataset (standardized scale) 
ValsPredictY 
predicted response values for supplementary dataset (original scale) 
Std.XChapeau 
estimated values for missing values in the predictor matrix (standardized scale) 
XXwotNA 
predictor matrix with missing values replaced with 0 
Use cv.plsR
to crossvalidate the plsRglm models and bootpls
to bootstrap them.
Frederic Bertrand
[email protected]
http://wwwirma.ustrasbg.fr/~fbertran/
Nicolas Meyer, Myriam MaumyBertrand et Frederic Bertrand (2010). Comparing the linear and the logistic PLS regression with qualitative predictors: application to allelotyping data. Journal de la Societe Francaise de Statistique, 151(2), pages 118. http://publicationssfds.math.cnrs.fr/index.php/JSFdS/article/view/47
See also plsRglm
to fit PLSGLR models.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74  data(Cornell)
XCornell<Cornell[,1:7]
yCornell<Cornell[,8]
#maximum 6 components could be extracted from this dataset
#trying 10 to trigger automatic stopping criterion
modpls10<plsR(yCornell,XCornell,10)
modpls10
#With iterated leave one out CV PRESS
modpls6cv<plsR(Y~.,data=Cornell,6,typeVC="standard")
modpls6cv
cv.modpls<cv.plsR(Y~.,data=Cornell,6,NK=100, verbose=FALSE)
res.cv.modpls<cvtable(summary(cv.modpls))
plot(res.cv.modpls)
rm(list=c("XCornell","yCornell","modpls10","modpls6cv"))
#A binary response example
data(aze_compl)
Xaze_compl<aze_compl[,2:34]
yaze_compl<aze_compl$y
modpls.aze < plsR(yaze_compl,Xaze_compl,10,MClassed=TRUE,typeVC="standard")
modpls.aze
#Direct access to not crossvalidated values
modpls.aze$AIC
modpls.aze$AIC.std
modpls.aze$MissClassed
#Raw predicted values (not really probabily since not constrained in [0,1]
modpls.aze$Probs
#Truncated to [0;1] predicted values (true probabilities)
modpls.aze$Probs.trc
modpls.aze$Probsmodpls.aze$Probs.trc
#Repeated cross validation of the model (NK=100 times)
cv.modpls.aze<cv.plsR(y~.,data=aze_compl,10,NK=100, verbose=FALSE)
res.cv.modpls.aze<cvtable(summary(cv.modpls.aze,MClassed=TRUE))
#High discrepancy in the number of component choice using repeated cross validation
#and missclassed criterion
plot(res.cv.modpls.aze)
rm(list=c("Xaze_compl","yaze_compl","modpls.aze","cv.modpls.aze","res.cv.modpls.aze"))
#24 predictors
dimX < 24
#2 components
Astar < 2
simul_data_UniYX(dimX,Astar)
dataAstar2 < data.frame(t(replicate(250,simul_data_UniYX(dimX,Astar))))
modpls.A2< plsR(Y~.,data=dataAstar2,10,typeVC="standard")
modpls.A2
cv.modpls.A2<cv.plsR(Y~.,data=dataAstar2,10,NK=100, verbose=FALSE)
res.cv.modpls.A2<cvtable(summary(cv.modpls.A2,verbose=FALSE))
#Perfect choice for the Q2 criterion in PLSR
plot(res.cv.modpls.A2)
#Binarized data.frame
simbin1 < data.frame(dicho(dataAstar2))
modpls.B2 < plsR(Y~.,data=simbin1,10,typeVC="standard",MClassed=TRUE, verbose=FALSE)
modpls.B2
modpls.B2$Probs
modpls.B2$Probs.trc
modpls.B2$MissClassed
plsR(simbin1$Y,dataAstar2[,1],10,typeVC="standard",MClassed=TRUE,verbose=FALSE)$InfCrit
cv.modpls.B2<cv.plsR(Y~.,data=simbin1,2,NK=100,verbose=FALSE)
res.cv.modpls.B2<cvtable(summary(cv.modpls.B2,MClassed=TRUE))
#Only one component found by repeated CV missclassed criterion
plot(res.cv.modpls.B2)
rm(list=c("dimX","Astar","dataAstar2","modpls.A2","cv.modpls.A2",
"res.cv.modpls.A2","simbin1","modpls.B2","cv.modpls.B2","res.cv.modpls.B2"))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.