Description Usage Arguments Details Value Author(s) See Also Examples
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.
1 | fit.lspcr.glm(Y,X,D,ncomp)
|
Y |
a vector of length |
X |
a data matrix ( |
D |
a data matrix ( |
ncomp |
a positive integer. |
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.
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 |
Caroline Bazzoli, Thomas Bouleau, Sophie Lambert-Lacroix
cv.lspcr.glm
,predict.lspcr.glm
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.