createSccsSimulationSettings | R Documentation |
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
)
nSites |
Number of database sites to simulate. |
n |
Number of subjects per site. Either a single number, or a vector of length nSites. |
atRiskTimeFraction |
Fraction of patient time when at risk (exposed). Either a single number, or a vector of length nSites. |
timePartitions |
Number of time partitions for seasonal covariates. Either a single number, or a vector of length nSites. |
timeCovariates |
Number of covariates to represent seasonality. Either a single number, or a vector of length nSites. |
timeEffectSize |
Strength of the seasonality effect. Either a single number, or a vector of length nSites. |
minBackgroundRate |
Minimum background outcome rate. Either a single number, or a vector of length nSites. |
maxBackgroundRate |
Maximum background outcome rate. Either a single number, or a vector of length nSites. |
rateRatio |
The incidence rate ratio. |
randomEffectSd |
Standard deviation of the |
An object of type simulationSccsSettings
, to be used in the simulatePopulations()
function.
simulatePopulations
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)
# (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.