Create training data for censoring probability estimation

create_final_data(
  clones,
  clone_followup,
  clone_outcome,
  clone_censoring,
  col_ids,
  timestamp_start = "Tstart",
  id = "ID",
  timestamp_stop = "Tstop"
)

Arguments

clones

A list of data frame. Each element of the list represents each treatment arm. This version of clones must contain a column that represents an emulated follow up time (corresponding to clone_followup argument), an emulated outcome (correspodning to clone_outcome), and a binary indicator variable that represents whether the observation violates arm's policy or not (corresponding to clone_censoring argument).

clone_followup

A column name that represents the emulated follow up time in each arm of clones. The variable should exists in each element data frame of clones argument.

clone_outcome

A column name that represents the emulated outcome in each arm of clones. The variable should exists in each element data frame of clones argument, and the variable value should be binary (0 or 1).

clone_censoring

A column name that represent whether the observation violates arm's policy or not. The variable should exists in each element data frame of clones argument, and the variable value should be binary (0 or 1).

col_ids

A vector of column names that a combination of their values uniquely identifies each observation.

timestamp_start

A new variable name to denote start time of each subrecord of observations in a long-form data.

id

A new variable name for a unique observation identifier, to represents that multiple rows in output data frame is associated with the same observation.

timestamp_stop

A new variable name to denote end time of each subrecord of observations in a long-form data.

Value

A list of long-form data frames. Each data frame represents each clone arm. Each row of the long-form data frame represents a subrecord of each observation associated with each specific time interval. The first subrecord starts with time 0, and the rows are expanded up to clone_followup, where cut times are determined by t_events argument.

Examples

data(lungcancer)
arms <- c("Control", "Surgery")
clones <- clone_arms(lungcancer, arms)
policies <- create_policy_A(
  arms, "surgery", "timetosurgery", 182.62, "death", "fup_obs",
  clone_outcome = "outcome", clone_followup = "fup"
)
clones_policy <- apply_logics(clones, policies)
censoring_logics <- create_censoring_logics_A(
  arms, "surgery", "timetosurgery", 182.62, "fup_obs",
  clone_censoring = "censoring",
  clone_uncensored_followup = "fup_uncensored"
)
clones_censored <- apply_logics(clones_policy, censoring_logics)
clones_final <- create_final_data(
  clones_censored,
  clone_followup = "fup",
  clone_outcome = "outcome",
  clone_censoring = "censoring",
  col_ids = "id"
)