simrecint: simrecint

View source: R/simrec_interim.R

simrecintR Documentation

simrecint

Description

With this function previously simulated data (for example simulated by the use of simrec or simreccomp) can be cut to an interim data set. The simulated data must be in patient time (i.e. time since the patient entered the study), and must be in the counting process format. Furthermore the dataset must have the variables id, start, stop and status, like data simulated by the use of simrec or simreccomp. Then for every individual additionally a recruitment time is generated in study time (i.e. time since start of the study), which is uniformly distributed on [0, tR]. The timing of the interim analysis tI is set in study time and data are being cut to all data, that are available at the interim analysis. For further explanations on study time and patient time see the vignette. If you only wish to simulate a recruitment time, tI can be set to tR + fu.max or something bigger.

Usage

simrecint(data, N, tR, tI)

Arguments

data

Previously generated data (in patient time), that shall be cut to interim data

N

Number of individuals, for which data was generated

tR

Length of the recruitment period (in study time)

tI

Timing of the interim analysis (in study time)

Value

The output is a data.frame consisting of the columns, that were put into, and additionally the following columns:

rectime

The recruitment time for each individual (in study time).

interimtime

The time of the interim analysis tI (in study time).

stop_study

The stopping time for each event in study time.

Individuals that are not already recruited at the interim analysis are left out here.

Author(s)

Katharina Ingel, Stella Preussler, Antje Jahn-Eimermacher. Institute of Medical Biostatistics, Epidemiology and Informatics (IMBEI), University Medical Center of the Johannes Gutenberg-University Mainz, Germany

See Also

simrec, simreccomp

Examples

### Example - see example for simrec
library(simrec)
N <- 10
dist.x <- c("binomial", "normal")
par.x <- list(0.5, c(0, 1))
beta.x <- c(0.3, 0.2)
dist.z <- "gamma"
par.z <- 0.25
dist.rec <- "weibull"
par.rec <- c(1, 2)
fu.min <- 2
fu.max <- 2
cens.prob <- 0.2

simdata <- simrec(
  N, fu.min, fu.max, cens.prob, dist.x, par.x, beta.x, dist.z,
  par.z, dist.rec, par.rec
)

### Now simulate for each patient a recruitment time in [0,tR=2]
### and cut data to the time of the interim analysis at tI=1:

simdataint <- simrecint(simdata, N = N, tR = 2, tI = 1)
# print(simdataint)  # only run for small N!

simrec documentation built on Sept. 8, 2023, 6:18 p.m.