Add inverse probability of censoring weights

weight_cases(
  clones,
  uncensored_prob = "P_uncens",
  numerator_uncensored_prob = "P_uncens_num",
  weight = "weight_Cox",
  eps = 1e-06
)

Arguments

clones

A named list of clone data frames returned by estimate_censoring().

uncensored_prob

Column name for denominator uncensoring probability.

numerator_uncensored_prob

Column name for numerator uncensoring probability. When this column exists, stabilized weights are created.

weight

Column name for the output weight.

eps

Small probability floor to avoid division by zero.

Value

A named list of clone data frames with the weight column added.

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, "fup", "outcome", "censoring", "id"
)
clones_estimated <- estimate_censoring(
  clones_final,
  predictors = c("age", "sex"),
  method = "pooled_logit"
)
clones_weighted <- weight_cases(clones_estimated)