Returns the raw survival data which was generated for simulation.
Arguments
- x
A survival
SimulationResultsobject created bygetSimulationSurvival(),getSimulationMultiArmSurvival(), orgetSimulationEnrichmentSurvival().- aggregate
Logical. If
TRUEthe raw data will be aggregated similar to the result ofgetData(), default isFALSE.
Value
Returns a data.frame.
Details
This function works only if the simulation function was called with
maxNumberOfRawDatasetsPerStage > 0 (default is 0). Multi-arm and
enrichment simulations must use a patient-wise simulation type.
This function can be used to get the simulated raw data from a simulation results object obtained from an ordinary, multi-arm, or enrichment survival simulation. The data frame contains the following columns:
iterationNumber: The number of the simulation iteration.stopStage: The stage of stopping.subjectId: The subject id (increasing number 1, 2, 3, ...)accrualTime: The accrual time, i.e., the time when the subject entered the trial.treatmentGroup: The treatment group number (1 or 2).survivalTime: The survival time of the subject.dropoutTime: The dropout time of the subject (may beNA).timeUnderObservation: The time under observation is defined as follows:if (event == TRUE) { timeUnderObservation <- survivalTime } else if (dropoutEvent == TRUE) { timeUnderObservation <- dropoutTime } else { timeUnderObservation <- analysisTime - accrualTime }where
analysisTimeis available from the corresponding row ofgetData().event:TRUEif an event occurred;FALSEotherwise.dropoutEvent:TRUEif an dropout event occurred;FALSEotherwise.
Multi-arm and enrichment raw data additionally contain a stable integer scenario
identifier. Enrichment raw data also contain the subject's subGroup. For these
simulation types, aggregate = TRUE aggregates multi-arm data by scenario and
iteration and enrichment data by scenario, iteration, and subgroup.
Examples
if (FALSE) { # \dontrun{
results <- getSimulationSurvival(
pi1 = seq(0.3, 0.6, 0.1), pi2 = 0.3, eventTime = 12,
accrualTime = 24, plannedEvents = 40, maxNumberOfSubjects = 200,
maxNumberOfIterations = 50, maxNumberOfRawDatasetsPerStage = 5
)
rawData <- getRawData(results)
head(rawData)
dim(rawData)
} # }
