Create an object specifying a simulation. Currently only Cox proportional hazard models are supported.
createSimulationSettings(
nSites = 5,
n = 10000,
treatedFraction = 0.2,
nStrata = 10,
minBackgroundHazard = 2e-07,
maxBackgroundHazard = 2e-05,
hazardRatio = 2,
randomEffectSd = 0
)
Number of database sites to simulate.
Number of subjects per site. Either a single number, or a vector of length nSites.
Fraction of subjects that is treated. Either a single number, or a vector of length nSites.
Number of strata per site. Either a single number, or a vector of length nSites.
Minimum background hazard. Either a single number, or a vector of length nSites.
Maximum background hazard. Either a single number, or a vector of length nSites.
Hazard ratio.
Standard deviation of the log(hazardRatio). Fixed effect if equal to 0.
An object of type simulationSettings
, to be used in the simulatePopulations()
function.
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)
#> x
#> 1.298901
# (Estimates in this example will vary due to the random simulation)