SelfControlledCaseSeries is part of the OHDSI Methods Library.


SelfControlledCaseSeries is an R package for performing Self-Controlled Case Series (SCCS) analyses in an observational database in the OMOP Common Data Model.


  • Extracts the necessary data from a database in OMOP Common Data Model format.
  • Optionally add seasonality using a spline function.
  • Optionally add age using a spline function.
  • Optionally correct for event-dependent censoring of the observation period.
  • Optionally add many covariates in one analysis (e.g. all drugs).
  • Options for constructing different types of covariates and risk windows, including pre-exposure windows (to capture contra-indications).
  • Optionally use regularization on all covariates except the outcome of interest.


sccsData <- getDbSccsData(connectionDetails = connectionDetails,
                          cdmDatabaseSchema = cdmDatabaseSchema,
                          outcomeIds = 192671,
                          exposureIds = 1124300)
covarDiclofenac = createCovariateSettings(label = "Exposure of interest",
                                          includeCovariateIds = 1124300,
                                          start = 0,
                                          end = 0,
                                          addExposedDaysToEnd = TRUE)
sccsEraData <- createSccsEraData(sccsData,
                                 naivePeriod = 180,
                                 firstOutcomeOnly = FALSE,
                                 covariateSettings = covarDiclofenac)
model <- fitSccsModel(sccsEraData)
# sccsModel object summary
# Outcome ID: 192671
# Outcome count:
#        Event count Case count
# 192671      433433     137888
# Estimates:
#                               Name    ID  Estimate  lower .95  upper .95   logRr  seLogRr
#   Exposure of interest: Diclofenac  1000     1.274      1.213      1.336  0.2421  0.02431


SelfControlledCaseSeries is an R package, with some functions implemented in C++.

System Requirements

Requires R (version 3.2.2 or higher). Installation on Windows requires RTools. Libraries used in SelfControlledCaseSeries require Java.

Getting Started

  1. On Windows, make sure RTools is installed.
  2. The DatabaseConnector and SqlRender packages require Java. Java can be downloaded from
  3. In R, use the following commands to download and install SelfControlledCaseSeries:



SelfControlledCaseSeries is licensed under Apache License 2.0


SelfControlledCaseSeries is being developed in R Studio.

Development status



  • This project is supported in part through the National Science Foundation grant IIS 1251151.
  • Part of the code is based on the SCCS package by Yonas Ghebremichael-Weldeselassie, Heather Whitaker, and Paddy Farrington.