predict.lspls.glm: Predict method for LS-PLS model fits.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Obtains predictions and prediction probabilities from a fitted LS-PLS object.

Usage

1
2
## S3 method for class 'lspls.glm'
predict(object,newX,newD,...)

Arguments

object

results from fit.lspls.glm function.

newX

new matrix of clinical data.

newD

new matrix of genetic data.

...

further arguments. Currently not used.

Details

This function is used to obtained predicted values using a model fitting with fit.lspls.glm. It returns predictions and prediction probabilites in case that the user wants to choose his own decision rule. By default (in the prediction vector) if probabilities are under 0.5 observations are in the 0 class and if probabilities are upper than 0.5 observations are in the 1 class.

Value

newY

the newY containing the n predicted values of the response variables for the observations from newX and newD.

newPi

the newPi containing the n probabilities of the response variables for the observations from newX and newD.

cvg

the 0-1 value indicating convergence of the algorithm (1 for convergence, 0 otherwise).

Author(s)

Caroline Bazzoli, Thomas Bouleau, Sophie Lambert-Lacroix

See Also

fit.lspls.glm.

Examples

 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
#Data
data(BreastCancer)
#vector of responses
Y<-BreastCancer$Y
#Genetic data
X<-BreastCancer$X
#Clinical data
D<-BreastCancer$D
#SIS selection
X<-scale(X)

X<-SIS.selection(X=X,Y=Y,pred=50)

#split data, 2/3 of our datasets are used to compose learning samples
index<-preselected.sample(Y,trunc(2*length(Y)/3)) 
XL<-X[index,]
DL<-D[index,]
YL<-Y[index]

#1/3 is four our test samples
XT<-X[-index,]
DT<-D[-index,]
YT<-Y[-index]

#cross validation to find the optimal number of component
#method LS-PLS-IRLS
ncompopt.lsplsirls<-cv.lspls.glm(Y=YL,X=XL,D=DL,folds=5,ncompmax=5,
                      proportion=0.7,method="LS-PLS-IRLS")$ncompopt
#method R-LS-PLS
cv<-cv.lspls.glm(Y=YL,X=XL,D=DL,ncompmax=5,proportion=0.7,method="R-LS-PLS",
                      lambda.grid=exp(log(10^seq(-3,2,0.7))),penalized=TRUE,
		      nbrIterMax=15,threshold=10^(-12))
ncompopt.rlspls<-cv$ncompopt
lambdaopt.rlspls<-cv$lambdaopt
#method IR-LS-PLS
ncompopt.irlspls<-cv.lspls.glm(Y=YL,X=XL,D=DL,ncompmax=5,proportion=0.7,method="IR-LS-PLS",
                                                 nbrIterMax=15,threshold=10^(-12))$ncompopt  

#fits
fit.lsplsirls<-fit.lspls.glm(Y=YL,X=XL,D=DL,ncomp=ncompopt.lsplsirls,
                                                method="LS-PLS-IRLS")
fit.rlspls<-fit.lspls.glm(Y=YL,X=XL,D=DL,ncomp=ncompopt.rlspls,method="R-LS-PLS",
                                          lambda=lambdaopt.rlspls,penalized=TRUE,
                                          nbrIterMax=15,threshold=10^(-12))
fit.irlspls<-fit.lspls.glm(Y=YL,X=XL,D=DL,ncomp=ncompopt.irlspls,method="IR-LS-PLS",
                                                   nbrIterMax=15,threshold=10^(-12))

#predictions
pred.lsplsrils<-predict.lspls.glm(fit.lsplsirls,newX = XT,newD = DT)
pred.rlspls<-predict.lspls.glm(fit.rlspls,newX = XT,newD = DT)
pred.irlspls<-predict.lspls.glm(fit.irlspls,newX = XT,newD = DT)

#Confusion mmatrix
table(YT,pred.lsplsrils$newY)
table(YT,pred.rlspls$newY) 
table(YT,pred.irlspls$newY) 

lsplsGlm documentation built on May 2, 2019, 12:36 p.m.