Constructs a PrevalenceType object specifying the prevalence type, lookback period, and calculation mode.

createPrevalenceType(prevalenceType, lookBackDays, mode = "formal")

Arguments

prevalenceType

Character string specifying prevalence type. Must be one of:

  • "point_prevalence": Status on a specific day (pn1 + pd1)

  • "period_prevalence_pd2": All time observed during period (pn2 + pd2)

  • "period_prevalence_pd3": Continuous observation (pn2 + pd3)

  • "period_prevalence_pd4": Sufficient days observed (pn2 + pd4)

lookBackDays

Integer number of days for lookback window. Must be an integer >= 0 or Inf for complete historical lookback. A value of 0 means no lookback — only events exactly on the interval day/period are counted.

mode

Character. Calculation mode controlling which cohort date anchors the event. Must be one of:

  • "formal" (default): Uses cohort_start_date as the anchor. Formal prevalence asks: did the disease START within the lookback window relative to the period of interest?

  • "rough": Uses cohort_end_date as the anchor. Rough prevalence asks: was the disease detected (still active) during the interval? This is a simpler detection-based calculation.

Value

A PrevalenceType R6 object.