|
| 1 | +library(riskRegression) |
| 2 | +library(survival) |
| 3 | +library(data.table) |
| 4 | +library(testthat) |
| 5 | +library(randomForestSRC) |
| 6 | +test_that("ipa cv5 survival",{ |
| 7 | + set.seed(8) |
| 8 | + learndat=sampleData(200,outcome="survival") |
| 9 | + testdat=sampleData(123,outcome="survival") |
| 10 | + cox1a = coxph(Surv(time,event)~X6,data=learndat,x=TRUE,y=TRUE) |
| 11 | + cox2a = coxph(Surv(time,event)~X7+X8+X9,data=learndat,x=TRUE,y=TRUE) |
| 12 | + set.seed(5) |
| 13 | + five <- Score(list("COX1"=cox1a,"COX2"=cox2a),formula=Surv(time,event)~1,data=learndat,times=5,B = 1,split.method="cv5",summary = "ipa",se.fit=TRUE,progress.bar=NULL) |
| 14 | + set.seed(5) |
| 15 | + loob <- Score(list("COX1"=cox1a,"COX2"=cox2a),formula=Surv(time,event)~1,data=learndat,times=5,summary = "ipa",split.method="loob",B=100,se.fit=TRUE,progress.bar=NULL,verbose = 0L) |
| 16 | + set.seed(5) |
| 17 | + loob_sans <- Score(list("COX1"=cox1a,"COX2"=cox2a),formula=Surv(time,event)~1,data=learndat,times=5,summary = "ipa",split.method="loob",B=100,se.fit=FALSE,progress.bar=NULL,verbose = 0L) |
| 18 | + set.seed(5) |
| 19 | + test <- Score(list("COX1"=cox1a,"COX2"=cox2a),formula=Surv(time,event)~1,data=testdat,times=5,summary = "ipa",se.fit=FALSE,progress.bar=NULL,verbose = 0L) |
| 20 | + set.seed(5) |
| 21 | + bootcv <- Score(list("COX1"=cox1a,"COX2"=cox2a),formula=Surv(time,event)~1,data=testdat,times=5,summary = "ipa",split.method = "bootcv",B = 5,se.fit=TRUE,progress.bar=NULL,verbose = 0L) |
| 22 | +}) |
| 23 | + |
0 commit comments