Learn R Programming

plsRglm (version 0.7.6)

PLS_lm_wvc: Light version of PLS_lm for cross validation purposes

Description

Light version of PLS_lm for cross validation purposes either on complete or incomplete datasets.

Usage

PLS_lm_wvc(dataY, dataX, nt = 2, dataPredictY = dataX, modele = "pls", scaleX = TRUE, scaleY = NULL, keepcoeffs = FALSE, keepstd.coeffs=FALSE, tol_Xi = 10^(-12), weights)

Arguments

dataY
response (training) dataset
dataX
predictor(s) (training) dataset
nt
number of components to be extracted
dataPredictY
predictor(s) (testing) dataset
modele
name of the PLS model to be fitted, only ("pls" available for this fonction.
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.
keepcoeffs
whether the coefficients of unstandardized eXplanatory variables should be returned or not.
keepstd.coeffs
whether the coefficients of standardized eXplanatory variables should be returned or not.
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.

Value

  • valsPredictnrow(dataPredictY) * nt matrix of the predicted values
  • coeffsIf the coefficients of the eXplanatory variables were requested: i.e. keepcoeffs=TRUE. ncol(dataX) * 1 matrix of the coefficients of the the eXplanatory variables

Details

This function is called by PLS_lm_kfoldcv in order to perform cross validation either on complete or incomplete datasets. 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.

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 for more detailed results, PLS_lm_kfoldcv for cross validating models and PLS_glm_wvc for the same function dedicated to plsRglm models

Examples

Run this code
data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
PLS_lm_wvc(dataY=yCornell,dataX=XCornell,nt=3,dataPredictY=XCornell[1,])
PLS_lm_wvc(dataY=yCornell[-c(1,2)],dataX=XCornell[-c(1,2),],nt=3,dataPredictY=XCornell[c(1,2),])
PLS_lm_wvc(dataY=yCornell[-c(1,2)],dataX=XCornell[-c(1,2),],nt=3,dataPredictY=XCornell[c(1,2),],keepcoeffs=TRUE)
rm("XCornell","yCornell")

## With an incomplete dataset (X[1,2] is NA)
data(pine)
ypine <- pine[,11]
data(XpineNAX21)
PLS_lm_wvc(dataY=log(ypine)[-1],dataX=XpineNAX21[-1,],nt=3)
PLS_lm_wvc(dataY=log(ypine)[-1],dataX=XpineNAX21[-1,],nt=3,dataPredictY=XpineNAX21[1,])
PLS_lm_wvc(dataY=log(ypine)[-2],dataX=XpineNAX21[-2,],nt=3,dataPredictY=XpineNAX21[2,])
PLS_lm_wvc(dataY=log(ypine),dataX=XpineNAX21,nt=3)
rm("XpineNAX21","ypine")

Run the code above in your browser using DataLab