Description Usage Arguments Details Value Author(s) See Also Examples
Obtains predictions and prediction probabilities from a fitted LS-PLS object.
1 2 |
object |
results from |
newX |
new matrix of clinical data. |
newD |
new matrix of genetic data. |
... |
further arguments. Currently not used. |
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.
newY |
the |
newPi |
the |
cvg |
the 0-1 value indicating convergence of the algorithm (1 for convergence, 0 otherwise). |
Caroline Bazzoli, Thomas Bouleau, Sophie Lambert-Lacroix
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.