Create a study population

createStudyPopulation(
  sccsData,
  outcomeId = NULL,
  firstOutcomeOnly = FALSE,
  naivePeriod = 0,
  minAge = NULL,
  maxAge = NULL,
  genderConceptIds = NULL,
  restrictTimeToEraId = NULL
)

Arguments

sccsData

An object of type SccsData as created using the getDbSccsData function.

outcomeId

The outcome to create the era data for. If not specified it is assumed to be the one outcome for which the data was loaded from the database.

firstOutcomeOnly

Whether only the first occurrence of an outcome should be considered.

naivePeriod

The number of days at the start of a patient's observation period that should not be included in the risk calculations. Note that the naive period can be used to determine current covariate status right after the naive period, and whether an outcome is the first one.

minAge

Minimum age at which patient time will be included in the analysis. Note that information prior to the min age is still used to determine exposure status after the minimum age (e.g. when a prescription was started just prior to reaching the minimum age). Also, outcomes occurring before the minimum age is reached will be considered as prior outcomes when using first outcomes only. Age should be specified in years, but non-integer values are allowed. If not specified, no age restriction will be applied.

maxAge

Maximum age at which patient time will be included in the analysis. Age should be specified in years, but non-integer values are allowed. If not specified, no age restriction will be applied.

genderConceptIds

Set of gender concept IDs to restrict the population to. If not specified, no restriction on gender will be applied.

restrictTimeToEraId

If provided, study time (for all patients) will be restricted to the calender time when that era was observed in the data. For example, if the era ID refers to a drug, study time will be restricted to when the drug was on the market.

Value

A list specifying the study population, with the following items:

  • cases: A tibble with one row per observation period of a person with the outcome.

  • outcomes: A tibble listing the days when a case has the outcome.

  • metaData: A list with meta data about the study population, including the attrition.

Details

Create a study population for a specific outcome, applying several restrictions.