File: test_surv_coxph.R

package info (click to toggle)
r-cran-mlr 2.18.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,088 kB
  • sloc: ansic: 65; sh: 13; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 647 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
context("surv_coxph")

test_that("surv_coxph", {
  requirePackagesOrSkip("survival", default.method = "load")

  parset.list = list(
    list(),
    list(iter.max = 1),
    list(iter.max = 10),
    list(iter.max = 50)
  )

  old.predicts.list = list()

  for (i in seq_along(parset.list)) {
    parset = parset.list[[i]]
    pars = list(formula = surv.formula, data = surv.train)
    pars = c(pars, parset)
    m = do.call(survival::coxph, pars)
    p = predict(m, newdata = surv.test, type = "lp")
    old.predicts.list[[i]] = p
  }

  testSimpleParsets("surv.coxph", surv.df, surv.target, surv.train.inds,
    old.predicts.list, parset.list)
})