Constructs a PrevalenceType object specifying the prevalence type, lookback period, lead-in requirement, and calculation mode.

createPrevalenceType(
  prevalenceType,
  lookBackDays,
  mode = "formal",
  leadInDays = 0L
)

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.

leadInDays

Integer number of days of continuous observation required before the start of each period of interest. Defaults to 0L (no lead-in requirement). Lead-in is a property of the prevalence definition rather than a shared experiment setting, so different prevalence types in the same experiment may use different values.

Value

A PrevalenceType R6 object.