search for: trainstatus

Displaying 2 results from an estimated 2 matches for "trainstatus".

2012 May 16
1
survival survfit with newdata
...ecause I cannot find a way of using 'newdata' with really new data. Thanks in advance. DK > x<-matrix(rnorm(100*20),100,20) > time<-runif(100,min=0,max=7) > status<-sample(c(0,1), 100, replace = TRUE) > trainX<-x[11:100,] > trainTime<-time[11:100] > trainStatus<-status[11:100] > testX<-x[1:10,] > coxph.model<- coxph(Surv(trainTime,trainStatus)~ trainX) > sfit<- survfit(coxph.model,newdata=data.frame(testX)) > dim(sfit$surv) [1] 90 90 [[alternative HTML version deleted]]
2012 May 07
1
estimating survival times with glmnet and coxph
...ks in advance. DK library(survival) library(glmnet) load(system.file("doc","VignetteExample.rdata",package="glmnet")) attach(patient.data) # leave the first patient for testing # and train glmnet on all other patients trainX????? <-x[-1,] trainTime?? <-time[-1] trainStatus <- status[-1] # fit Coxnet fit <- glmnet(trainX,Surv(trainTime,trainStatus),family="cox",alpha=0.5,maxit=10000) # find lambda for which dev.ratio is max max.dev.index???? <- which.max(fit$dev.ratio) optimal.lambda <- fit$lambda[max.dev.index] # take beta for optimal lambda...