Identify a set of denominator populations using a target cohort
generateTargetDenominatorCohortSet.Rd
generateTargetDenominatorCohortSet()
creates a set of cohorts that
can be used for the denominator population in analyses of incidence,
using estimateIncidence()
, or prevalence, using estimatePointPrevalence()
or estimatePeriodPrevalence()
.
Arguments
- cdm
A CDM reference object
- name
Name of the cohort table to be created.
- targetCohortTable
A cohort table in the cdm reference to use to limit cohort entry and exit (with individuals only contributing to a cohort when they are contributing to the cohort in the target table).
- targetCohortId
The cohort definition id for the cohort of interest in the target table. If targetCohortTable is specified, a single targetCohortId must also be specified.
- cohortDateRange
Two dates. The first indicating the earliest cohort start date and the second indicating the latest possible cohort end date. If NULL or the first date is set as missing, the earliest observation_start_date in the observation_period table will be used for the former. If NULL or the second date is set as missing, the latest observation_end_date in the observation_period table will be used for the latter.
- timeAtRisk
Lower and upper bound for the time at risk window to apply relative to the target cohort entry. A value of list(c(0, 30), c(31, 60)) would, for example, create one set of denominator cohorts with time up to the 30 days following target cohort entry and another set with time from 31 days following entry to 60 days. If time at risk start is after target cohort exit and/ or observation period end then no time will be contributed. If time at risk end is after cohort exit and/ or observation period, then only time up to these will be contributed.
- ageGroup
A list of age groups for which cohorts will be generated. A value of
list(c(0,17), c(18,30))
would, for example, lead to the creation of cohorts for those aged from 0 to 17, and from 18 to 30. In this example an individual turning 18 during the time period would appear in both cohorts (leaving the first cohort the day before their 18th birthday and entering the second from the day of their 18th birthday).- sex
Sex of the cohorts. This can be one or more of:
"Male"
,"Female"
, or"Both"
.- daysPriorObservation
The number of days of prior observation observed in the database required for an individual to start contributing time in a cohort.
- requirementInteractions
If TRUE, cohorts will be created for all combinations of ageGroup, sex, and daysPriorObservation. If FALSE, only the first value specified for the other factors will be used. Consequently, order of values matters when requirementInteractions is FALSE.
Examples
# \donttest{
cdm <- mockIncidencePrevalenceRef(sampleSize = 1000)
cdm <- generateTargetDenominatorCohortSet(
cdm = cdm,
name = "denominator",
targetCohortTable = "target",
cohortDateRange = as.Date(c("2008-01-01", "2020-01-01"))
)
#> ℹ Creating denominator cohorts: target cohort id 1
#> ✔ Cohorts created in 0 min and 3 sec
cdm
#>
#> ── # OMOP CDM reference (duckdb) of mock ───────────────────────────────────────
#> • omop tables: person, observation_period
#> • cohort tables: target, outcome, denominator
#> • achilles tables: -
#> • other tables: -
# }