createSccsSimulationSettings: Create SCCS simulation settings

View source: R/Simulation.R

createSccsSimulationSettingsR Documentation

Create SCCS simulation settings

Description

Create an object specifying a simulation for the Self-Controlled Case Series (SCCS).

Usage

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.

See Also

simulatePopulations

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)

# (Estimates in this example will vary due to the random simulation)


EvidenceSynthesis documentation built on Aug. 26, 2025, 9:08 a.m.