Nothing
test_that("baseline_hazard works for Weibull", {
t <- c(1, 2, 3)
bh <- baseline_hazard(t, baseline = "weibull", par = c(2, 1.5))
expect_true(all(bh$H0 > 0))
expect_true(all(bh$h0 > 0))
expect_equal(length(bh$H0), 3)
# Check mathematical values: H0 = (t/2)^1.5
expect_equal(bh$H0, (t / 2)^1.5, tolerance = 1e-10)
})
test_that("baseline_hazard works for Generalized Weibull (GW)", {
t <- c(0.5, 1, 2.5)
bh <- baseline_hazard(t, baseline = "gw", par = c(0.5, 1.2, 1.1))
expect_true(all(bh$H0 > 0))
expect_true(all(bh$h0 > 0))
expect_true(all(is.finite(bh$H0)))
expect_true(all(is.finite(bh$h0)))
})
test_that("r_gw produces valid random samples", {
set.seed(42)
x <- r_gw(500, delta = 0.5, zeta = 1.2, xi = 1.1)
expect_equal(length(x), 500)
expect_true(all(x > 0))
expect_true(all(is.finite(x)))
})
test_that("baseline_hazard validates inputs", {
expect_error(baseline_hazard(c(-1, 2), "weibull", c(1, 1)))
expect_error(baseline_hazard(c(1, 2), "weibull", c(-1, 1)))
expect_error(baseline_hazard(c(1, 2), "gw", c(1, 1))) # wrong parameter length
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.