createSimulationSettings | R Documentation |
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
)
nSites |
Number of database sites to simulate. |
n |
Number of subjects per site. Either a single number, or a vector of length nSites. |
treatedFraction |
Fraction of subjects that is treated. Either a single number, or a vector of length nSites. |
nStrata |
Number of strata per site. Either a single number, or a vector of length nSites. |
minBackgroundHazard |
Minimum background hazard. Either a single number, or a vector of length nSites. |
maxBackgroundHazard |
Maximum background hazard. Either a single number, or a vector of length nSites. |
hazardRatio |
Hazard ratio. |
randomEffectSd |
Standard deviation of the log(hazardRatio). Fixed effect if equal to 0. |
An object of type simulationSettings
, to be used in the simulatePopulations()
function.
simulatePopulations
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.