R/acc_frac.R

Defines functions .acc_frac

#' Fraction of the sample size enrolled by calendar time
#'
#' @param acc Output of \code{.acc_setup()}.
#' @param x Calendar times.
#' @return Numeric vector of enrolled fractions.
#' @noRd
.acc_frac <- function(acc, x) {
  a <- acc$alpha
  lo <- a[-length(a)]
  hi <- a[-1L]
  vapply(x, function(z) sum(acc$rho * pmax(pmin(z, hi) - lo, 0)), numeric(1))
}

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.