Learn R Programming

plsRglm (version 0.3.3)

PLS_lm: 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

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))

Arguments

dataY
response (training) dataset
dataX
predictor(s) (training) dataset
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 argumlent is ignored and set thanks to the value of modele.
typeVC
type of leave one out crossed 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 not 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 missclassed 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}$

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.

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

PLS_lm_wvc and PLS_lm_kfoldcv

Examples

Run this code
data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
PLS_lm(yCornell,XCornell,10)$InfCrit
PLS_lm(yCornell,XCornell,10,typeVC="standard")$CVinfos
PLS_lm(yCornell,XCornell,6)$AIC 
PLS_lm(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 <- PLS_lm(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
PLS_lm(yaze_compl,Xaze_compl,10)$InfCrit

PLS_lm(yaze_compl,Xaze_compl,10,typeVC="standard")$CVinfos
PLS_lm(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)
PLS_lm(ysimbin1,Xsimbin1,10,MClassed=TRUE)$Probs
PLS_lm(ysimbin1,Xsimbin1,10,MClassed=TRUE)$Probs.trc
PLS_lm(ysimbin1,Xsimbin1,10,MClassed=TRUE)$MissClassed
PLS_lm(ysimbin1,Xsimbin1,10,typeVC="standard",MClassed=TRUE)$CVinfos
PLS_lm(ysimbin1,XdataAstar2,10,typeVC="standard",MClassed=TRUE)$CVinfos
PLS_lm(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 <- PLS_lm(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 <- PLS_lm(ydataAstar2,XdataAstar2,10,typeVC="standard")
modpls$computed_nt
modpls$CVinfos
rm(list=c("dimX","Astar","dataAstar2","modpls","ydataAstar2","XdataAstar2"))


# Comparing the results with the plspm package and SIMCA results in Tenenhaus's book
library(plspm)

data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
plsreg1(x=XCornell,y=as.vector(yCornell),nc=3)$coeffs
PLS_lm(yCornell,XCornell,3)$uscores
PLS_lm(yCornell,XCornell,3)$pp
PLS_lm(yCornell,XCornell,3)$Coeffs

plsreg1(x=XCornell,y=as.vector(yCornell),nc=4,cv=TRUE)
PLS_lm(yCornell,XCornell,4,typeVC="standard")$press.ind
PLS_lm(yCornell,XCornell,4,typeVC="standard")$press.tot
PLS_lm(yCornell,XCornell,4,typeVC="standard")$CVinfos
plsreg1(x=XCornell,y=as.vector(yCornell),nc=4,cv=TRUE)$Q2


data(pine)
Xpine<-pine[,1:10]
ypine<-pine[,11]
PLS_lm(log(ypine),Xpine,4)$Std.Coeffs
plsreg1(x=Xpine,y=log(as.vector(ypine)),nc=4)$std.coef
PLS_lm(log(ypine),Xpine,4)$Coeffs
plsreg1(x=Xpine,y=log(as.vector(ypine)),nc=4)$coeffs
PLS_lm(log(ypine),Xpine,1)$Std.Coeffs
PLS_lm(log(ypine),Xpine,1)$Coeffs
plsreg1(x=Xpine,y=log(as.vector(ypine)),nc=10)$Q2
PLS_lm(log(ypine),Xpine,10,typeVC="standard")$CVinfos
plsreg1(x=Xpine,y=log(as.vector(ypine)),nc=4,cv=TRUE)$Q2


data(pine_full)
Xpine_full<-pine_full[,1:10]
ypine_full<-pine_full[,11]
PLS_lm(log(ypine_full),Xpine_full,1)$Std.Coeffs
PLS_lm(log(ypine_full),Xpine_full,1)$Coeffs
plsreg1(x=Xpine_full,y=log(as.vector(ypine_full)),nc=4)$coeffs
cor(cbind(Xpine,log(ypine)))


XpineNAX21 <- Xpine
XpineNAX21[1,2] <- NA
PLS_lm(log(ypine),XpineNAX21,4)$Std.Coeffs

PLS_lm(log(ypine),XpineNAX21,4)$YChapeau[1,]
PLS_lm(log(ypine),Xpine,4)$YChapeau[1,]

PLS_lm(log(ypine),XpineNAX21,4)$CoeffC

plsreg1(x=XpineNAX21,y=as.vector(log(ypine)),nc=4,cv=TRUE)
PLS_lm(log(ypine),XpineNAX21,2,dataPredictY=XpineNAX21[1,])$ValsPredictY

PLS_lm(log(ypine),Xpine,10,typeVC="none")$InfCrit
PLS_lm(log(ypine),Xpine,10,typeVC="standard")$CVinfos
PLS_lm(log(ypine),Xpine,10,typeVC="adaptative")$CVinfos
PLS_lm(log(ypine),Xpine,10,typeVC="missingdata")$CVinfos
PLS_lm(log(ypine),XpineNAX21,10,typeVC="none")$InfCrit
PLS_lm(log(ypine),XpineNAX21,10,typeVC="standard")$CVinfos
PLS_lm(log(ypine),XpineNAX21,10,typeVC="adaptative")$CVinfos
PLS_lm(log(ypine),XpineNAX21,10,typeVC="missingdata")$CVinfos

PLS_lm(log(ypine),XpineNAX21,4,EstimXNA=TRUE)$XChapeau
PLS_lm(log(ypine),XpineNAX21,4,EstimXNA=TRUE)$XChapeauNA
rm(list=c("XCornell","yCornell","Xpine","ypine","Xpine_full","ypine_full","XpineNAX21"))



dimX <- 24
Astar <- 3
dataAstar3 <- t(replicate(200,simul_data_UniYX(dimX,Astar)))
ydataAstar3 <- dataAstar3[,1]
XdataAstar3 <- dataAstar3[,2:(dimX+1)]
modpls <- PLS_lm(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 <- PLS_lm(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 <- PLS_lm(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 <- PLS_lm(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