tests/testthat/test-fun_vals.R

test_that(".fun_vals gives the functions of the score, variance and event", {
  scn <- scn_c()
  s <- c(0.5, 4, 12)
  f <- .alt_funs(scn, s, "pfs")
  v0 <- .fun_vals(scn, s, "pfs", 0L)
  v1 <- .fun_vals(scn, s, "pfs", 1L)
  expect_equal(v0$rho[, "psi"], -f[, "q1"])
  expect_equal(v1$rho[, "psi"] - v0$rho[, "psi"], rep(1, 3))
  expect_equal(v1$rho[, "phi"], f[, "q1"] * (1 - f[, "q1"]))
  expect_equal(v1$beta[, "psi"], -(1 - f[, "q1"]) * f[, "lbar"])
  expect_equal(v0$beta[, "phi"], -(1 - 2 * f[, "q1"]) * f[, "q1"] * f[, "lbar"])
  expect_equal(v1$rho[, "dlt"], rep(1, 3))
  expect_equal(v1$beta[, "dlt"], rep(0, 3))
})

Try the DesignComplexSurvival package in your browser

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

DesignComplexSurvival documentation built on Nov. 23, 2026, 5:07 p.m.