tests/testthat/test-piecewiseHazards.R

# getPWCHazard ----

test_that("getPWCHazard works as expected", {
  actual <- getPWCHazard(c(0.8, 1.1, 1), c(0, 5, 8), c(1, 5, 7, 9))
  expect_identical(actual, c(0.8, 1.1, 1.1, 1))
})


# getSumPCW ----
test_that("getSumPCW works as expected", {
  actual <- getSumPCW(c(0.8, 1.1, 1), c(0.8, 1.1, 1, 0.4), c(0, 5, 8), c(0, 3, 7, 9))
  expect_equal(actual, list(hazards = c(1.6, 1.9, 2.2, 2.1, 2, 1.4), intervals = c(0, 3, 5, 7, 8, 9)))
})

Try the simIDM package in your browser

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

simIDM documentation built on May 29, 2024, 6:38 a.m.