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
)

Arguments

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 log(hazardRatio). Fixed effect if equal to 0.

Value

An object of type simulationSccsSettings, to be used in the simulatePopulations() function.

Examples

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)