predict.lspcr.glm: Predict method for LS-PCR fits.

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

Description

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

Usage

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

Arguments

object

results from fit.lspcr.glm function.

newX

new matrix of genetic data.

newD

new matrix of clinical data.

...

further arguments. Currently not used.

Details

This function is used to obtained predicted values using a model fitting with fit.lspcr.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.lspcr.glm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#Data
data(BreastCancer)
#Vector of response
Y<-BreastCancer$Y
#Genetic data
X<-BreastCancer$X
#Clinical data
D<-BreastCancer$D

#Learn dataset and test dataset (80/20)
index<-preselected.sample(Y,round(length(Y)*0.8))
XL<-X[index,]
XT<-X[-index,]
DL<-D[index,]
DT<-D[-index,]
YL<-Y[index]
#Apply fit.lspcr.glm with 5 components
fit<-fit.lspcr.glm(Y=YL,X=XL,D=DL,ncomp=5)
#predictions
pred<-predict.lspcr.glm(fit,newD=DT,newX=XT)

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