vignettes/cohortincidence-method-documentation.Rmd
cohortincidence-method-documentation.Rmd
The incidence calculation method of CohortIncidence supports multiple cohort episodes per person and multiple outcomes per person, and accounts for immortal time from outcomes and clean windows. This article describes the methods of excluding immortal time from time-at-risk, and the calculations behind the incidence rate and incidence proportion statistics.
When describing the CohortIncidence method, there are several key concepts to understand:
Incidence proportion is reported as ‘per 100 people’, and Incidence rate is reported as ‘per 100 person years’.
The figure below represents a single person in the target cohort with 3 episodes of a treatment, and the time-at-risk specification extending the first episode into the second. This person also has 6 outcome events represented by the gold stars, and the clean window extending from each outcome, causing time at risk to be excluded and certain outcomes to be ignored.
Figure 1: The initial intervals of time-at-risk, outcomes and clean windows.
Overlapping intervals of TAR and clean windows need to be ‘flattened’ and outcomes that occur during clean windows are removed. After this is done, the person TAR, clean window and outcomes look like the following figure: Figure 2: Merging TAR and clean windows, and removing outcomes from clean windows.
With the time at risk and clean windows merged, all time at risk that overlaps with clean window periods are removed from the person. The result looks like the following: Figure 3: TAR excluded from patient timeline.
With the TAR cleaned up, the final timeline is used to calculate the incidence rates and proportions:
Figure 4: The final timeline used to calculate incidence.
Incidence Rate = cases / TAR. In this example, there are only 2 cases during TAR. Incidence Proportion = (distinct people with cases) / (distinct people). This person contributes one person count and one person with case count.
Some analytic use cases call for only following the patient until the first outcome. This means, in a CohortIncidence context, that after an outcome, no further outcomes are allowed and no post-outcome time-at-risk should be counted. This is handled by setting a ‘9999’ clean window so that all time after an outcome is excluded.
Note: using this approach will exclude anyone with a prior outcome, since their time-at-risk will be completely excluded. In order to ignore prior outcomes but exclude all time after the first outcome after exposure, a specialized ‘O-with-prior-T’ outcome cohort is required that will only capture outcomes that occur post-T.
The following table represents a data set of calculated time at risk, cases, and calculated rates/proportions:
person_id | time_at_risk_pe | time_at_risk | cases_pe | cases |
---|---|---|---|---|
1 | 365 | 365 | 0 | 0 |
2 | 365 | 0 | 1 | 0 |
3 | 365 | 120 | 2 | 1 |
In this example, person 1 has no time-at-risk excluded, and zero cases. Person 2 has all time-at-risk excluded (from a clean window) with a case pre-exclude (pe), but no cases after time-at-risk was excluded. Person 3 has part of their time-at-risk excluded, with 1 actual case (1 case was during a clean window).
Persons at risk = 2 (person 2 contributed zero time-at-risk, so is not included in this count)
Total time-at-risk = 485d (sum of time_at_risk)
Persons with cases = 1
cases = 1
Calculations:
incidence proportion (persons per 100 persons): (persons with cases / persons at risk) * 100.0 1/2 * 100.0 = 50%
incidence rate (cases per 100 person years): (cases / (time at risk / 365.25)) * 100.0 1/(485/365.25) * 100.0 = 75.3 cases per 100 person years.