Learn R Programming

EvidenceSynthesis (version 1.0.0)

simulatePopulations: Simulate survival data for multiple databases

Description

Simulate survival data for multiple databases

Usage

simulatePopulations(settings = createSimulationSettings())

Value

A object of class simulation, which is a list of population data frames. Depending on the type of simulation, the data frames have different columns: Cox simulations will have the columns rowId, stratumId, x, time, and y. SCCS simulations will have the columns stratumId, a, x1...xN, time, and y.

Arguments

settings

Either an object of type simulationSettings, created by the createSimulationSettings() function or an object of type sccsSimulationSettings as created by the createSccsSimulationSettings() function.

Examples

Run this code
settings <- createSimulationSettings(nSites = 1, hazardRatio = 2)
populations <- simulatePopulations(settings)

# Fit a Cox regression for the simulated data site:
cyclopsData <- Cyclops::createCyclopsData(Surv(time, y) ~ x + strata(stratumId),
  data = populations[[1]],
  modelType = "cox"
)
cyclopsFit <- Cyclops::fitCyclopsModel(cyclopsData)
coef(cyclopsFit)

# (Estimates in this example will vary due to the random simulation)

Run the code above in your browser using DataLab