fit.lspcr.glm: Fitting a LS-PCR model for logistic regression

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

Description

Fits a model the combination of two methods: Ordinary Least Square (OLS) and Principal Component Regression (PCR) to fit both clinical and gene expression data.

Usage

1
  fit.lspcr.glm(Y,X,D,ncomp)

Arguments

Y

a vector of length n giving the classes of the n observations. The classes must be coded as 1 or 0.

X

a data matrix (nxp) of genes. NAs and Inf are not allowed. Each row corresponds to an observation and each column to a gene.

D

a data matrix (nxq) of clinical data. NAs and Inf are not allowed. Each row corresponds to an observation and each column to a clinical variable.

ncomp

a positive integer. ncomp is the number of selected components.

Details

This function combines two methods, the first one is the Principal Components Regression on genetic data to reduce the dimension using prcomp from {stats} package. The second one is the logistic regression on the concatenation of the ncomp first selected axes and clinical data (D) to explain Y. To do that we use glm from {stats} package.

Value

coefficients

coefficients of logistic regression.

cvg

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

projection

projection matrix used to convert X to scores.

Author(s)

Caroline Bazzoli, Thomas Bouleau, Sophie Lambert-Lacroix

See Also

cv.lspcr.glm,predict.lspcr.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
 
#Data
data(BreastCancer)
#Vector of response
Y<-BreastCancer$Y
#Genetic data
X<-BreastCancer$X
#Clinical data
D<-BreastCancer$D
#Apply fit.lspcr.glm with ncomp=5 using the 76 first patients
fit<-fit.lspcr.glm(Y=Y[1:76],X=X[1:76,],D=D[1:76,],ncomp=5)

#using projection to predict class of 2 last patients
newX<-X[77:78,]
newD<-D[77:78,]

#New Score matrix
newScores<-newX%*%fit$projection

#prediction
newEta=cbind(rep(1,dim(newD)[1]),newD,newScores)%*%fit$coefficients
newPi=1/(1+exp(-newEta))
newY=as.numeric(newEta>0)

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