tests/testthat/helper-data.R

make_toy_curves <- function(n = 30, Q = 40, seed = 1) {
  set.seed(seed)
  times <- seq(0, 5, length.out = Q)
  grp <- sample(1:2, n, TRUE)
  rates <- c(0.2, 0.7)

  S <- sapply(times, function(t) exp(-rates[grp] * t))
  S <- S + matrix(stats::rnorm(n * Q, 0, 0.01), nrow = n)
  S[S < 0] <- 0
  S[S > 1] <- 1

  list(S = S, times = times, grp = grp)
}

Try the unsurv package in your browser

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

unsurv documentation built on Sept. 1, 2026, 1:06 a.m.