| predict.cvRLassoCox {RLassoCox} | R Documentation |
This function makes predictions from a cross-validated RLasso-Cox model, using the optimal value chosen for lambda.
## S3 method for class 'cvRLassoCox' predict(object, newx, ...)
object |
cross-validated RLasso-Cox model |
newx |
A matrix with new samples to predict. |
... |
Arguments to be passed to |
Predicted results of new patients in newx.
library("survival")
library("igraph")
library("glmnet")
library("Matrix")
data(dGMMirGraph)
data(mRNA_matrix)
data(survData)
trainSmpl.Idx <- sample(1:dim(mRNA_matrix)[1], floor(2/3*dim(mRNA_matrix)[1]))
testSmpl.Idx <- setdiff(1:dim(mRNA_matrix)[1], trainSmpl.Idx)
trainSmpl <- mRNA_matrix[trainSmpl.Idx ,]
testSmpl <- mRNA_matrix[testSmpl.Idx ,]
cv.res <- cvRLassoCox(x=trainSmpl, y=survData[trainSmpl.Idx ,],
globalGraph=dGMMirGraph, nfolds = 5)
lp <- predict(object = cv.res, newx = testSmpl,
s = "lambda.min")