Estimate the emulated trial effect

emul_estimate(
  clones_weighted,
  method = c("Cox", "logistic", "KM"),
  cluster = "id",
  weights = NULL,
  predictors = NULL,
  outcome = "outcome",
  time_start = "Tstart",
  time_stop = "Tstop",
  arm = "arms"
)

Arguments

clones_weighted

A named list of weighted clone data frames, or a single data frame containing an arm column.

method

Analysis method: "Cox", "logistic", or "KM".

cluster

Column name used for robust clustering in Cox models.

weights

Optional weight column name. Unquoted column names are also accepted when they exist in the data.

predictors

Optional adjustment predictors. For KM, predictors define additional strata rather than covariate adjustment.

outcome

Column name for the outcome indicator.

time_start

Column name for interval start time.

time_stop

Column name for interval stop time.

arm

Column name for treatment arm after binding clone lists.

Value

A fitted model object: "coxph" for Cox, "glm" for logistic, or "survfit" for KM.

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)
fit <- emul_estimate(
  clones_weighted,
  method = "Cox",
  weights = "weight_Cox",
  predictors = c("age", "sex")
)