simulate_trial: Simulate a clinical trial

View source: R/simulation.R

simulate_trialR Documentation

Simulate a clinical trial

Description

Simulate a single- or two-arm clinical trial, where end of study (EOS) is triggered after a number of events has been observed or a certain time has elapsed. Whereas simulate_arm provides complete data for patients, including time to event and loss of follow-up, simulate_trial mimicks an actual survival study by providing only the observed time (minimum of time to event or censoring) and censoring indicator.

Usage

simulate_trial(arm0 = NA, arm1 = NA, events = NA, duration = Inf)

Arguments

arm0

object of class 'arm'.

arm1

object of class 'arm'.

events

number of required events to trigger end of study; overrides study duration defined within arm0 and arm1.

duration

time from first-patient-in to trigger end of study; overrides study duration defined within arm0 and arm1. If both events and duration are specified, end of study is triggered by either criteria, whichever occurs first.

Value

arm

0=arm0, 1=arm1

time.accr

time to accrual

time.obs

time to observation from accrual

time.total

time to observation from start of study

censor

0=censor, 1=event

reason

event description ('[experience ]event', '[loss to ]followup', 'administration[ censoring]')

See Also

simulate_arm for simulating complete data for a single arm, create_arm for creating an object of class 'arm'.

Examples

arm0 <- create_arm(size=120, accr_time=6, surv_scale=0.05, loss_scale=0.005, follow_time=12)
arm1 <- create_arm(size=120, accr_time=6, surv_scale=0.03, loss_scale=0.005, follow_time=12)
simulate_trial(arm0, duration=10)
simulate_trial(arm0, arm1, events=50)

npsurvSS documentation built on May 29, 2024, 11:23 a.m.