TTEDesign class for target trial emulation
TTEDesign class for target trial emulation
Details
Holds column name mappings that define the schema for trial data. This allows specifying variable names once and reusing them across all TTE workflow functions.
See also
[TTEEnrollment] for the trial class
Other tte_classes:
TTEEnrollment,
TTEPlan
Public fields
person_id_varCharacter or NULL, person identifier column name.
id_varCharacter, person-trial identifier column name.
exposure_varCharacter, exposure/treatment column name.
outcome_varsCharacter vector, outcome column names.
confounder_varsCharacter vector, confounder column names.
follow_up_timeInteger, follow-up duration.
tstart_varCharacter, period start time column name.
tstop_varCharacter, period end time column name.
time_exposure_varCharacter or NULL, time-varying exposure column.
eligible_varCharacter or NULL, eligibility column name.
admin_censor_varCharacter or NULL, admin censoring column.
admin_censor_isoyearweekCharacter or NULL, admin censoring date.
period_widthInteger, band width in weeks for enrollment/aggregation.
Methods
Method new()
Create a new TTEDesign object.
Usage
TTEDesign$new(
person_id_var = NULL,
id_var = "enrollment_person_trial_id",
exposure_var,
outcome_vars,
confounder_vars,
follow_up_time,
tstart_var = "tstart",
tstop_var = "tstop",
time_exposure_var = NULL,
eligible_var = NULL,
admin_censor_var = NULL,
admin_censor_isoyearweek = NULL,
period_width = 4L
)Arguments
person_id_varCharacter or NULL, name of the person identifier column for pre-panel (person-week) data (default: NULL).
id_varCharacter, name of the person-trial identifier column (default: "enrollment_person_trial_id").
exposure_varCharacter, name of the baseline exposure/treatment column.
outcome_varsCharacter vector, names of outcome event indicator columns.
confounder_varsCharacter vector, names of confounder columns for propensity/censoring models.
follow_up_timeInteger, expected follow-up duration in time units.
tstart_varCharacter, name of period start time column (default: "tstart").
tstop_varCharacter, name of period end time column (default: "tstop").
time_exposure_varCharacter or NULL, name of time-varying exposure column for per-protocol analysis (default: NULL).
eligible_varCharacter or NULL, name of eligibility indicator column (default: NULL).
admin_censor_varCharacter or NULL, name of administrative censoring boundary column (default: NULL). Mutually exclusive with `admin_censor_isoyearweek`.
admin_censor_isoyearweekCharacter or NULL, the study end date in ISO year-week format (e.g., "2023-52"). When set, administrative censoring is computed internally as weeks from each trial's entry date to this global study end date. Requires an `isoyearweek` column in the data. Mutually exclusive with `admin_censor_var` (default: NULL).
period_widthInteger, band width in weeks for enrollment and time aggregation (default: 4L). Calendar time is grouped into bands of this width. Must be a positive integer.
Method check_version()
Check if this object's schema version matches the current class version. Warns if the object was saved with an older schema version.
Examples
# Design for post-panel (trial-level) data
design <- TTEDesign$new(
id_var = "enrollment_person_trial_id",
exposure_var = "baseline_exposed",
outcome_vars = c("death", "hosp"),
confounder_vars = c("age", "education"),
follow_up_time = 156L
)
# Design for pre-panel (person-week) data with full workflow
design_prepanel <- TTEDesign$new(
person_id_var = "id",
exposure_var = "baseline_exposed",
outcome_vars = c("death", "hosp"),
confounder_vars = c("age", "education"),
follow_up_time = 156L,
eligible_var = "eligible"
)
