Create a study population

createStudyPopulation(
  cohortMethodData,
  population = NULL,
  outcomeId = NULL,
  firstExposureOnly = FALSE,
  restrictToCommonPeriod = FALSE,
  washoutPeriod = 0,
  removeDuplicateSubjects = "keep all",
  removeSubjectsWithPriorOutcome = TRUE,
  priorOutcomeLookback = 99999,
  minDaysAtRisk = 1,
  maxDaysAtRisk = 99999,
  riskWindowStart = 0,
  startAnchor = "cohort start",
  riskWindowEnd = 0,
  endAnchor = "cohort end",
  censorAtNewRiskWindow = FALSE
)

Arguments

cohortMethodData

An object of type CohortMethodData as generated using getDbCohortMethodData().

population

If specified, this population will be used as the starting point instead of the cohorts in the cohortMethodData object.

outcomeId

The ID of the outcome. If NULL, no outcome-specific transformations will be performed.

firstExposureOnly

Should only the first exposure per subject be included?

restrictToCommonPeriod

Restrict the analysis to the period when both exposures are observed?

washoutPeriod

The minimum required continuous observation time prior to index date for a person to be included in the cohort.

removeDuplicateSubjects

Remove subjects that are in both the target and comparator cohort? See details for allowed values.

removeSubjectsWithPriorOutcome

Remove subjects that have the outcome prior to the risk window start?

priorOutcomeLookback

How many days should we look back when identifying prior outcomes?

minDaysAtRisk

The minimum required number of days at risk. Risk windows with fewer days than this number are removed from the analysis.

maxDaysAtRisk

The maximum allowed number of days at risk. Risk windows that are longer will be truncated to this number of days.

riskWindowStart

The start of the risk window (in days) relative to the startAnchor.

startAnchor

The anchor point for the start of the risk window. Can be "cohort start" or "cohort end".

riskWindowEnd

The end of the risk window (in days) relative to the endAnchor.

endAnchor

The anchor point for the end of the risk window. Can be "cohort start" or "cohort end".

censorAtNewRiskWindow

If a subject is in multiple cohorts, should time-at-risk be censored when the new time-at-risk starts to prevent overlap?

Value

A tibble specifying the study population. This tibble will have the following columns:

  • rowId: A unique identifier for an exposure.

  • personSeqId: The person sequence ID of the subject.

  • cohortStartdate: The index date.

  • outcomeCount The number of outcomes observed during the risk window.

  • timeAtRisk: The number of days in the risk window.

  • survivalTime: The number of days until either the outcome or the end of the risk window.

Details

Create a study population by enforcing certain inclusion and exclusion criteria, defining a risk window, and determining which outcomes fall inside the risk window.

The removeduplicateSubjects argument can have one of the following values:

  • "keep all": Do not remove subjects that appear in both target and comparator cohort

  • "keep first": When a subjects appear in both target and comparator cohort, only keep whichever cohort is first in time. If both cohorts start simultaneous, the person is removed from the analysis.

  • "remove all": Remove subjects that appear in both target and comparator cohort completely from the analysis."