tests/testthat/test-bootstrap.R

context("bootstrap.R unit tests")
library("flexsurv")

# Partitioned survival fits  ---------------------------------------------------
test_that("bootstrap.partsurvfit() works even when some replications have errors ", {
  fit <- suppressWarnings(flexsurvreg(formula = Surv(futime, fustat) ~ age, 
                                     data = ovarian[1:2, ], dist="gamma"))
  fit <- partsurvfit(flexsurvreg_list(fit), data = ovarian[1:2, ])
  set.seed(101)
  expect_warning(bootstrap(fit, B = 5, max_errors = 10, silent = TRUE))
  set.seed(101)
})

Try the hesim package in your browser

Any scripts or data that you put into this service are public.

hesim documentation built on Sept. 4, 2022, 1:06 a.m.