createSimulationSettings {EvidenceSynthesis} | R Documentation |
Create simulation settings
Description
Create an object specifying a simulation. Currently only Cox proportional hazard models are supported.
Usage
createSimulationSettings(
nSites = 5,
n = 10000,
treatedFraction = 0.2,
nStrata = 10,
minBackgroundHazard = 2e-07,
maxBackgroundHazard = 2e-05,
hazardRatio = 2,
randomEffectSd = 0
)
Arguments
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. |
Value
An object of type simulationSettings
, to be used in the simulatePopulations()
function.
See Also
Examples
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)
[Package EvidenceSynthesis version 0.5.0 Index]