plsR {plsRglm}R Documentation

Partial least squares Regression models with leave one out cross validation

Description

This function implements Partial least squares Regression models with leave one out cross validation for complete or incomplete datasets.

Usage

plsR(object, ...)
## Default S3 method:
plsRmodel(object, 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(object, 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)

Arguments

object

response (training) dataset or an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under 'Details'.

dataY

response (training) dataset

dataX

predictor(s) (training) dataset

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under 'Details'.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which plsR is called.

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 ("pls" available for this fonction.

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 (missingdata) or selects the prediction method accordingly to the completeness of the row (adaptative).

none

no cross validation

standard

as in SIMCA for datasets without any missing value. For datasets with any missing value, it is the as using missingdata

missingdata

all values predicted as those with missing values for datasets with any missing values

adaptative

predict a response value for an x with any missing value as those with missing values and for an x without any missing value as those without missing values.

EstimXNA

only for modele="pls". Set whether the missing X values have to be estimated.

scaleX

scale the predictor(s) : must be set to TRUE for modele="pls" and should be for glms pls.

scaleY

scale the response : Yes/No. Ignored since non always possible for glm responses.

pvals.expli

should individual p-values 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 \mathrm{det}(pp' \times pp) if there is any missing value in the dataX. It defaults to 10^{-12}

weights

an optional vector of 'prior weights' to be used in the fitting process. Should be NULL or a numeric vector.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

sparse

should the coefficients of non-significant predictors (<alpha.pvals.expli) be set to 0

sparseStop

should component extraction stop when no significant predictors (<alpha.pvals.expli) are found

naive

Use the naive estimates for the Degrees of Freedom in plsR? Default is FALSE.

verbose

should info messages be displayed ?

...

arguments to pass to plsRmodel.default or to plsRmodel.formula

Details

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 re-ordered so that main effects come first, followed by the interactions, all second-order, all third-order and so on: to avoid this pass a terms object as the formula.

Non-NULL 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 unit-weight 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), 697-705, 2011.

Value

nr

Number of observations

nc

Number of predictors

nt

Number of requested components

ww

raw weights (before L2-normalization)

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 non-NA 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 cross-validation 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:
i.e. MClassed=TRUE.

MissClassed

Number of miss classed results

Probs

"Probability" predicted by the model. These are not true probabilities since they may lay outside of [0,1]

Probs.trc

Probability predicted by the model and constrained to belong to [0,1]

ttPredictFittedMissingY

Description of 'comp2'

optional

If cross validation was requested:
i.e. typeVC="standard", typeVC="missingdata" or typeVC="adaptative".

R2residY

R2 coefficient value on the standardized scale

R2

R2 coefficient value on the original scale

press.tot2

total PRESS value for all observations (original scale)

Q2

Q2 value (standardized scale)

limQ2

limit of the Q2 value

Q2_2

Q2 value (original scale)

Q2cum

cumulated Q2 (standardized scale)

Q2cum_2

cumulated Q2 (original scale)

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

Note

Use cv.plsR to cross-validate the plsRglm models and bootpls to bootstrap them.

Author(s)

Frederic Bertrand
frederic.bertrand@utt.fr
https://fbertran.github.io/homepage/

References

Nicolas Meyer, Myriam Maumy-Bertrand 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 1-18. http://publications-sfds.math.cnrs.fr/index.php/J-SFdS/article/view/47

See Also

See also plsRglm to fit PLSGLR models.

Examples

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 cross-validated 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$Probs-modpls.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"))


[Package plsRglm version 1.5.1 Index]