Augment Long-Format Data with Mammogram and Time-Since-Last-Mammogram Columns

Description

Adds the time-varying screening covariates required by compute_ipw_weights() and fit_screening_propensity() to long-format data produced by expand_to_long(). It merges the observed mammogram events onto each participant-arm-month and derives the screening indicator, the time since the last mammogram, and the breast-cancer diagnosis month.

Usage

augment_long_covariates(
  long_data,
  screening_mammograms,
  diagnostic_mammograms,
  id_col = "id",
  arm_col = "arm",
  month_col = "month",
  month2_col = "month2",
  bc_long_col = "bc_long",
  event_month_col = "month",
  dx_reclass_months = 8L
)

Arguments

long_data A data frame in long format (one row per participant-arm-month), as produced by expand_to_long(). Must contain the id, arm, month, month2, and bc_long columns (or as specified via the *_col arguments).
screening_mammograms A data frame of screening mammogram events with participant ID and calendar month columns.
diagnostic_mammograms A data frame of diagnostic mammogram events with participant ID and calendar month columns.
id_col Name of the participant ID column. Default: “id”.
arm_col Name of the trial arm column. Default: “arm”.
month_col Name of the calendar-month column (same scale as the mammogram event months). Default: “month”.
month2_col Name of the 0-indexed month-from-entry column. Default: “month2”.
bc_long_col Name of the per-month breast-cancer-diagnosis indicator column. Default: “bc_long”.
event_month_col Name of the calendar-month column in the mammogram event data frames. Default: “month”.
dx_reclass_months A screening mammogram occurring this many months or fewer after the previous mammogram is reclassified as diagnostic. Default: 8L.

Details

The construction follows the SAS cann17b long-covariate augmentation. For each participant-arm, with rows ordered by month2:

  1. scrmammo and dxmammo are set to 1 in months with a screening or diagnostic mammogram event, respectively, and 0 otherwise.

  2. A screening mammogram is forced at trial entry (month2 == 0).

  3. anymammo is 1 when either a screening or diagnostic mammogram occurred that month. The time-since-last-mammogram clock is reset by any mammogram.

  4. A screening mammogram in the month immediately after a breast-cancer diagnosis is not counted as screening (scrmammo set to 0).

  5. tslm is the running count of months since the last mammogram (0 in any month with a mammogram, otherwise the previous value plus 1). tslm_lag is tslm from the previous month (NA at entry), and is the value used downstream.

  6. A screening mammogram within dx_reclass_months months of the previous mammogram (tslm_lag <= dx_reclass_months) is reclassified as diagnostic: dxmammo set to 1 and scrmammo set to 0.

monthBC is the month2 value at which breast cancer was diagnosed (constant within each participant-arm, NA if no diagnosis), derived from the bc_long indicator. It is the column compute_ipw_weights() expects via its bc_month_col argument.

Value

long_data with six additional columns:

  • scrmammo: Screening-mammogram indicator for the month (0/1).

  • dxmammo: Diagnostic-mammogram indicator for the month (0/1).

  • anymammo: Any-mammogram indicator for the month (0/1).

  • tslm: Months since the last mammogram at this month.

  • tslm_lag: tslm from the previous month (NA at entry).

  • monthBC: month2 of breast-cancer diagnosis (NA if none).

References

García-Albéniz X, Uno H, Bhatt DL, McArdle PH, Joffe MM, Hernán MA. Continuation of Annual Screening Mammography and Breast Cancer Mortality in Women Older Than 70 Years: A Prospective Observational Study. Ann Intern Med. 2020;172(6):381-389. doi:10.7326/M18-1199

See Also

expand_to_long() for the preceding step, fit_screening_propensity() and compute_ipw_weights() for the steps that consume these columns.

Examples

Code
library("ettbc")

cloned <- clone_censor(cohort, screening_mammograms, diagnostic_mammograms)
long_data <- expand_to_long(cloned)
long_data <- augment_long_covariates(
  long_data,
  screening_mammograms,
  diagnostic_mammograms
)
head(long_data[, c("id", "arm", "month2", "tslm_lag", "monthBC")])
  id      arm month2 tslm_lag monthBC
1  1 STOPBASE      0       NA      NA
2  1 STOPBASE      1        0      NA
3  1 STOPBASE      2        1      NA
4  1 STOPBASE      3        2      NA
5  1 STOPBASE      4        3      NA
6  1 STOPBASE      5        4      NA