data(veteran)
t0=proc.time()
## Use half of the observations for demonstration
set.seed(27695)
train.id <- sort(sample(1:nrow(veteran),ceiling(nrow(veteran)/2)))
cossoCox <- cosso.cox(veteran[train.id,5:7],veteran[train.id,1],veteran[train.id,2],nbasis=20)
print((proc.time()-t0)[3])
## Parallel Computing
## Not recommended in this example
data(veteran)
t0=proc.time()
## Use half of the observations for demonstration
set.seed(27695)
train.id <- sort(sample(1:nrow(veteran),ceiling(nrow(veteran)/2)))
cossoCox <- cosso.cox(veteran[train.id,5:7],veteran[train.id,1],veteran[train.id,2],parallel=TRUE,cpus=2)
print((proc.time()-t0)[3])
## Adaptive COSSO-Cox
data(veteran)
adawt <- SSANOVAwt.cox(veteran[,5:7],veteran[,1],veteran[,2])
ada.CoxObj <- cosso.cox(veteran[,5:&],veteran[,1],veteran[,2],adawt,FALSE,parallel=FALSE)
Run the code above in your browser using DataLab