Create an object specifying a simulation for the Self-Controlled Case Series (SCCS).
createSccsSimulationSettings(
nSites = 5,
n = 10000,
atRiskTimeFraction = 0.1,
timePartitions = 24,
timeCovariates = 5,
timeEffectSize = log(2),
minBackgroundRate = 0.001,
maxBackgroundRate = 0.01,
rateRatio = 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 patient time when at risk (exposed). Either a single number, or a vector of length nSites.
Number of time partitions for seasonal covariates. Either a single number, or a vector of length nSites.
Number of covariates to represent seasonality. Either a single number, or a vector of length nSites.
Strength of the seasonality effect. Either a single number, or a vector of length nSites.
Minimum background outcome rate. Either a single number, or a vector of length nSites.
Maximum background outcome rate. Either a single number, or a vector of length nSites.
The incidence rate ratio.
Standard deviation of the log(hazardRatio). Fixed effect if equal to 0.
An object of type simulationSccsSettings, to be used in the simulatePopulations() function.
settings <- createSccsSimulationSettings(nSites = 1, rateRatio = 2)
populations <- simulatePopulations(settings)
# Fit a SCCS regression for the simulated data site:
cyclopsData <- Cyclops::createCyclopsData(
y ~ a + x1 + x2 + x3 + x4 + x5 + strata(stratumId) + offset(log(time)),
data = populations[[1]],
modelType = "cpr"
)
cyclopsFit <- Cyclops::fitCyclopsModel(cyclopsData)
coef(cyclopsFit)
#> a x1 x2 x3 x4 x5
#> 0.50702050 -0.89521673 -0.10599550 -0.69481827 0.32917307 -0.04000263
# (Estimates in this example will vary due to the random simulation)