Skip to contents

Add competing risk survival information to a cohort table

Usage

addCompetingRiskCohortSurvival(
  x,
  cdm,
  outcomeCohortTable,
  outcomeCohortId = 1,
  outcomeDateVariable = "cohort_start_date",
  outcomeWashout = Inf,
  outcomeCensorOnCohortExit = FALSE,
  outcomeCensorOnDate = NULL,
  outcomeFollowUpDays = Inf,
  competingOutcomeCohortTable,
  competingOutcomeCohortId = 1,
  competingOutcomeDateVariable = "cohort_start_date",
  competingOutcomeWashout = Inf,
  competingOutcomeCensorOnCohortExit = FALSE,
  competingOutcomeCensorOnDate = NULL,
  competingOutcomeFollowUpDays = Inf
)

Arguments

x

cohort table to add survival information

cdm

CDM reference

outcomeCohortTable

The outcome cohort table of interest.

outcomeCohortId

ID of event cohorts to include. Only one outcome (and so one ID) can be considered.

outcomeDateVariable

Variable containing date of outcome event

outcomeWashout

Washout time in days for the outcome

outcomeCensorOnCohortExit

If TRUE, an individual's follow up will be censored at their cohort exit

outcomeCensorOnDate

if not NULL, an individual's follow up will be censored at the given date

outcomeFollowUpDays

Number of days to follow up individuals (lower bound 1, upper bound Inf)

competingOutcomeCohortTable

The outcome cohort table of interest.

competingOutcomeCohortId

ID of event cohorts to include. Only one outcome (and so one ID) can be considered.

competingOutcomeDateVariable

Variable containing date of competing outcome event

competingOutcomeWashout

Washout time in days for the competing outcome

competingOutcomeCensorOnCohortExit

If TRUE, an individual's follow up will be censored at their cohort exit

competingOutcomeCensorOnDate

if not NULL, an individual's follow up will be censored at the given date

competingOutcomeFollowUpDays

Number of days to follow up individuals (lower bound 1, upper bound Inf)

Value

Two additional columns will be added to x. The "time" column will contain number of days to censoring. The "status" column will indicate whether the patient had the outcome event (value: 1), competing event (value:2) or did not have the event/is censored (value: 0)

Examples

# \donttest{

cdm <- mockMGUS2cdm()
#> ■■■■■■■■■■■■■■■■■■■■■■■■■         80% | ETA:  1s
crsurvivaldata <- cdm$mgus_diagnosis %>%
  addCompetingRiskCohortSurvival(
    cdm = cdm,
    outcomeCohortTable = "progression",
    outcomeCohortId = 1,
    competingOutcomeCohortTable = "death_cohort",
    competingOutcomeCohortId = 1
  )
  # }