sample_conditional_fun: Draw conditional survival times based on study settings

View source: R/paket_nph_2-1_1.R

sample_conditional_funR Documentation

Draw conditional survival times based on study settings

Description

Simulates data for a randomized controlled survival study conditional on observed interim data.

Usage

sample_conditional_fun(
  dat,
  A,
  B,
  r0 = 0.5,
  eventEnd,
  lambdaRecr,
  lambdaCens,
  maxRecrCalendarTime,
  maxCalendar
)

Arguments

dat

A data frame with the same structure and column names as the output of sample_fun, containing the data to condition on

A

An object of class mixpch, resembling the survival function in treatment group 0

B

An object of class mixpch, resembling the survival function in treatment group 1

r0

Allocation ratio to group 1 (must be a number between 0 and 1)

eventEnd

Number of events, after which the study stops

lambdaRecr

Rate per day for recruiting patients, assuming recruitung follows a Poisson process

lambdaCens

Rate per day for random censoring, assuming censoring times are exponential

maxRecrCalendarTime

Maximal duration of recruitment in days

maxCalendar

Maximal total study duration in days, after which the study stops

Details

For simulating the data, patients are allocated randomly to either group (unrestricted randomization).

Value

A data frame with each line representing data for one patient and the following columns:

group

Treatment group

inclusion

Start of observation in terms of calendar time

y

Observed survival/censored time

yCalendar

End of observation in terms of calendar time.

event

logical, TRUE indicates the observation ended with an event, FALSE corresponds to censored times

adminCens

logical, True indicates that the observation is subject to administrative censoring, i.e. the subject was observed until the end of the study without an event.

cumEvents

Cumulative number of events over calendar time of end of observation

The data frame is ordered by yCalendar

Author(s)

Robin Ristl, robin.ristl@meduniwien.ac.at

References

Robin Ristl, Nicolas Ballarini, Heiko Götte, Armin Schüler, Martin Posch, Franz König. Delayed treatment effects, treatment switching and heterogeneous patient populations: How to design and analyze RCTs in oncology. Pharmaceutical statistics. 2021; 20(1):129-145.

See Also

rSurv_fun, rSurv_conditional_fun, sample_fun

Examples

A <- pop_pchaz(Tint = c(0, 90, 1500),
  lambdaMat1 = matrix(c(0.2, 0.1, 0.4, 0.1), 2, 2) / 365,
 lambdaMat2 = matrix(c(0.5, 0.2, 0.6, 0.2), 2, 2) / 365,
 lambdaProg = matrix(c(0.5, 0.5, 0.4, 0.4), 2, 2) / 365,
 p = c(0.8, 0.2), 
 timezero = FALSE, discrete_approximation = TRUE)
B <- pop_pchaz(Tint = c(0, 90, 1500),
  lambdaMat1 = matrix(c(0.2, 0.1, 0.4, 0.1), 2, 2) / 365,
 lambdaMat2 = matrix(c(0.5, 0.1, 0.6, 0.1), 2, 2) / 365,
 lambdaProg = matrix(c(0.5, 0.5, 0.04, 0.04), 2, 2) / 365,
 p = c(0.8, 0.2), 
 timezero = FALSE, discrete_approximation = TRUE)
datinterim <- sample_fun(A, B, r0 = 0.5, eventEnd = 30, lambdaRecr = 1,
  lambdaCens = 0.25 / 365,
 maxRecrCalendarTime = 3 * 365,
 maxCalendar = 4 * 365)
datcond <- sample_conditional_fun(datinterim, A, B, r0 = 0.5, eventEnd = 60,
  lambdaRecr = 1, lambdaCens = 0.25 / 365, maxRecrCalendarTime = 3 * 365, 
  maxCalendar = 4 * 365)

nph documentation built on May 17, 2022, 1:06 a.m.