Skip to contents

eEvents_df computes expected events over time and by strata under the assumption of piecewise constant enrollment rates and piecewise exponential failure and censoring rates. The piecewise exponential distribution allows a simple method to specify a distribtuion and enrollment pattern where the enrollment, failure and dropout rates changes over time. While the main purpose may be to generate a trial that can be analyzed at a single point in time or using group sequential methods, the routine can also be used to simulate an adaptive trial design. The intent is to enable sample size calculations under non-proportional hazards assumptions for stratified populations.

Usage

eEvents_df(
  enrollRates = tibble::tibble(duration = c(2, 2, 10), rate = c(3, 6, 9)),
  failRates = tibble::tibble(duration = c(3, 100), failRate = log(2)/c(9, 18),
    dropoutRate = rep(0.001, 2)),
  totalDuration = 25,
  simple = TRUE
)

Arguments

enrollRates

Enrollment rates; see details and examples

failRates

Failure rates and dropout rates by period

totalDuration

Total follow-up from start of enrollment to data cutoff

simple

If default (TRUE), return numeric expected number of events, otherwise a tibble as described below.

Value

The default when simple=TRUE is to return the total expected number of events as a real number. Otherwise, when simple=FALSE a tibble is returned with the following variables for each period specified in 'failRates': t start of period, failRate failure rate during the period Events expected events during the period,

The records in the returned tibble correspond to the input tibble

failRates.

Details

More periods will generally be supplied in output than those that are input. The intent is to enable expected event calculations in a tidy format to maximize flexibility for a variety of purposes.

Specification

Examples

library(tibble)
library(gsDesign2)

# Default arguments, simple output (total event count only)
eEvents_df()
#> [1] 57.3537

# Event count by time period
eEvents_df(simple = FALSE)
#> # A tibble: 2 × 3
#>       t failRate Events
#>   <dbl>    <dbl>  <dbl>
#> 1     0   0.0770   22.2
#> 2     3   0.0385   35.1

# Early cutoff
eEvents_df(totalDuration = .5)
#> [1] 0.02850923

# Single time period example
eEvents_df(enrollRates = tibble(duration = 10,rate = 10),
           failRates = tibble(duration=100, failRate = log(2) / 6 ,dropoutRate = .01),
           totalDuration = 22,
           simple = FALSE)
#> # A tibble: 1 × 3
#>       t failRate Events
#>   <dbl>    <dbl>  <dbl>
#> 1     0    0.116   80.4

# Single time period example, multiple enrollment periods
eEvents_df(enrollRates = tibble(duration = c(5,5), rate = c(10, 20)),
           failRates = tibble(duration = 100, failRate = log(2)/6, dropoutRate = .01),
           totalDuration = 22, simple = FALSE)
#> # A tibble: 1 × 3
#>       t failRate Events
#>   <dbl>    <dbl>  <dbl>
#> 1     0    0.116   119.