Skip to contents

Wrapper for speff2trial::speffsurv: See speff2trial::speffSurv

Usage

speffsurv_impart(
  data,
  estimand = "log_hazard_ratio",
  formula,
  treatment_column = NULL,
  alpha = 0.05,
  ci = FALSE
)

Arguments

data

A data.frame

estimand

A character vector - must be "log_hazard_ratio" (default)

formula

A formula for covariate adjustment.

treatment_column

A character scalar, indicating the column containing the treatment indicator.

alpha

A numeric scalar, indicating Type I error rate

ci

A logical scalar: should CI be returned

Value

A list containing the estimate, standard error, estimand, and confidence interval (if requested).

Examples


# Extract two treatment arms: Lev+5FU (Chemotherapy) and Obs (Observation)
colon_cancer_5fu_vs_obs <-
  subset(
    x = colon_cancer,
    arm %in% c("Lev+5FU", "Obs")
  ) |>
  droplevels()

speffsurv_impart(
  data = colon_cancer_5fu_vs_obs,
  estimand = "log_hazard_ratio",
  formula =
    survival::Surv(time = years_to_death, event = event_death) ~
    age + sex + obstruction + perforation + organ_adherence + positive_nodes +
    differentiation + local_spread,
  treatment_column = "arm",
  alpha = 0.05,
  ci = FALSE
)
#> Warning: argument is not numeric or logical: returning NA
#> Warning: argument is not numeric or logical: returning NA
#> Error in `[<-`(`*tmp*`, list, value = structure(list(sex = structure(2:1, levels = c("0. Female", "1. Male"), class = "factor")), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"))): Subscript `list` is a matrix, the data `values` must have size 1.