Learn R Programming

plsRglm (version 0.7.6)

plsR: 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(x, ...)
## S3 method for class 'default':
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)
## S3 method for class 'formula':
plsRmodel(formula,data,nt=2,limQ2set=.0975,dataPredictY,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=TRUE,naive=FALSE)

Arguments

x
a formula or a response (training) dataset
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 fro
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 and may be forced. [object Object],[object Object],[object Object],[object Object]
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.
...
arguments to pass to plsRmodel.default or to plsRmodel.formula

Value

  • nrDescription of 'comp1'
  • ncDescription of 'comp2'
  • ntDescription of 'comp2'
  • wwDescription of 'comp2'
  • wwnormDescription of 'comp2'
  • wwetoileDescription of 'comp2'
  • ttDescription of 'comp2'
  • ppDescription of 'comp2'
  • CoeffCDescription of 'comp2'
  • uscoresDescription of 'comp2'
  • YChapeauDescription of 'comp2'
  • residYChapeauDescription of 'comp2'
  • RepYDescription of 'comp2'
  • na.miss.YDescription of 'comp2'
  • YNADescription of 'comp2'
  • residYDescription of 'comp2'
  • ExpliXDescription of 'comp2'
  • na.miss.XDescription of 'comp2'
  • XXNADescription of 'comp2'
  • residXXDescription of 'comp2'
  • PredictYDescription of 'comp2'
  • press.indDescription of 'comp2'
  • press.totDescription of 'comp2'
  • famillyDescription of 'comp2'
  • ttPredictYDescription of 'comp2'
  • typeVCDescription of 'comp2'
  • dataYDescription of 'comp2'
  • computed_ntDescription of 'comp2'
  • CoeffCFullDescription of 'comp2'
  • CoeffConstanteDescription of 'comp2'
  • Std.CoeffsDescription of 'comp2'
  • press.ind2Description of 'comp2'
  • RSSresidYDescription of 'comp2'
  • CoeffsDescription of 'comp2'
  • YresidusDescription of 'comp2'
  • RSSDescription of 'comp2'
  • residusYDescription of 'comp2'
  • AIC.stdAIC.std vs number of components (AIC computed for the standardized model
  • AICAIC vs nber of components
  • optionalIf the response is assumed to be binary: i.e. MClassed=TRUE. [object Object],[object Object],[object Object]
  • ttPredictFittedMissingYDescription of 'comp2'
  • optionalIf cross validation was requested: i.e. typeVC="standard", typeVC="missingdata" or typeVC="adaptative". [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
  • optionalIf no cross validation was requested : i.e. typeVC="none". [object Object]
  • Std.ValsPredictYDescription of 'comp2'
  • ValsPredictYDescription of 'comp2'
  • Std.XChapeauDescription of 'comp2'
  • XXwotNADescription of 'comp2'

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 Kraemer, N., Sugiyama M. (2010). "The Degrees of Freedom of Partial Least Squares Regression". preprint, http://arxiv.org/abs/1002.4112.

References

Nicolas Meyer, Myriam Maumy-Bertrand et Fr�d�ric{Fr'ed'eric} Bertrand (2010). Comparaison de la r�gression{r'egression} PLS et de la r�gression{r'egression} logistique PLS : application aux donn�es{donn'ees} d'all�lotypage{d'all'elotypage}. Journal de la Soci�t� Fran�aise de Statistique, 151(2), pages 1-18. http://smf4.emath.fr/Publications/JSFdS/151_2/pdf/sfds_jsfds_151_2_1-18.pdf

See Also

plsRglm

Examples

Run this code
data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
plsR(yCornell,XCornell,10)$InfCrit
plsR(yCornell,XCornell,10,typeVC="standard")$CVinfos
plsR(yCornell,XCornell,6)$AIC 
plsR(yCornell,XCornell,6)$AIC.std    
rm(list=c("XCornell","yCornell"))


data(aze_compl)
Xaze_compl<-aze_compl[,2:34]
yaze_compl<-aze_compl$y

modpls <- plsR(yaze_compl,Xaze_compl,10,MClassed=TRUE)

modpls$AIC
modpls$AIC.std
modpls$MissClassed
modpls$Probs
modpls$Probs.trc
modpls$Probs-modpls$Probs.trc

modpls$InfCrit
plsR(yaze_compl,Xaze_compl,10)$InfCrit

plsR(yaze_compl,Xaze_compl,10,typeVC="standard")$CVinfos
plsR(yaze_compl,Xaze_compl,10,typeVC="standard",MClassed=TRUE)$CVinfos
rm(list=c("Xaze_compl","yaze_compl","modpls"))


dimX <- 24
Astar <- 2
simul_data_UniYX(dimX,Astar)
dataAstar2 <- t(replicate(250,simul_data_UniYX(dimX,Astar)))
ydataAstar2 <- dataAstar2[,1]
XdataAstar2 <- dataAstar2[,2:(dimX+1)]
ysimbin1 <- dicho(ydataAstar2)
Xsimbin1 <- dicho(XdataAstar2)
plsR(ysimbin1,Xsimbin1,10,MClassed=TRUE)$Probs
plsR(ysimbin1,Xsimbin1,10,MClassed=TRUE)$Probs.trc
plsR(ysimbin1,Xsimbin1,10,MClassed=TRUE)$MissClassed
plsR(ysimbin1,Xsimbin1,10,typeVC="standard",MClassed=TRUE)$CVinfos
plsR(ysimbin1,XdataAstar2,10,typeVC="standard",MClassed=TRUE)$CVinfos
plsR(ydataAstar2,XdataAstar2,10,typeVC="standard")$CVinfos
rm(list=c("dimX","Astar","dataAstar2","ysimbin1","Xsimbin1","ydataAstar2","XdataAstar2"))


dimX <- 6
Astar <- 4
dataAstar4 <- t(replicate(250,simul_data_UniYX(dimX,Astar)))
ydataAstar4 <- dataAstar4[,1]
XdataAstar4 <- dataAstar4[,2:(dimX+1)]
modpls <- plsR(ydataAstar4,XdataAstar4,10,typeVC="standard")
modpls$computed_nt
modpls$CVinfos
str(modpls)
rm(list=c("dimX","Astar","dataAstar4","modpls","ydataAstar4","XdataAstar4"))


dimX <- 24
Astar <- 2
dataAstar2 <- t(replicate(250,simul_data_UniYX(dimX,Astar)))
ydataAstar2 <- dataAstar2[,1]
XdataAstar2 <- dataAstar2[,2:(dimX+1)]
modpls <- plsR(ydataAstar2,XdataAstar2,10,typeVC="standard")
modpls$computed_nt
modpls$CVinfos
rm(list=c("dimX","Astar","dataAstar2","modpls","ydataAstar2","XdataAstar2"))


dimX <- 24
Astar <- 3
dataAstar3 <- t(replicate(200,simul_data_UniYX(dimX,Astar)))
ydataAstar3 <- dataAstar3[,1]
XdataAstar3 <- dataAstar3[,2:(dimX+1)]
modpls <- plsR(ydataAstar3,XdataAstar3,10,typeVC="standard")
modpls$computed_nt
modpls$CVinfos
rm(list=c("dimX","Astar","dataAstar3","modpls","ydataAstar3","XdataAstar3"))


dimX <- 24
Astar <- 4
dataAstar4 <- t(replicate(200,simul_data_UniYX(dimX,Astar)))
ydataAstar4 <- dataAstar4[,1]
XdataAstar4 <- dataAstar4[,2:(dimX+1)]
modpls <- plsR(ydataAstar4,XdataAstar4,10,typeVC="standard")
modpls$computed_nt
modpls$CVinfos
rm(list=c("dimX","Astar","dataAstar4","modpls","ydataAstar4","XdataAstar4"))


dimX <- 24
Astar <- 5
dataAstar5 <- t(replicate(200,simul_data_UniYX(dimX,Astar)))
ydataAstar5 <- dataAstar5[,1]
XdataAstar5 <- dataAstar5[,2:(dimX+1)]
modpls <- plsR(ydataAstar5,XdataAstar5,10,typeVC="standard")
modpls$computed_nt
modpls$CVinfos
rm(list=c("dimX","Astar","dataAstar5","modpls","ydataAstar5","XdataAstar5"))


dimX <- 24
Astar <- 6
dataAstar6 <- t(replicate(200,simul_data_UniYX(dimX,Astar)))
ydataAstar6 <- dataAstar6[,1]
XdataAstar6 <- dataAstar6[,2:(dimX+1)]
modpls <- plsR(ydataAstar3,XdataAstar6,10,typeVC="standard")
modpls$computed_nt
modpls$CVinfos
rm(list=c("dimX","Astar","dataAstar6","modpls","ydataAstar6","XdataAstar6"))

Run the code above in your browser using DataLab