# Testing dataset with just two treatment arms.
library(dplyr)
adtte_f <- tern_ex_adtte %>%
filter(
PARAMCD == "OS",
ARM %in% c("B: Placebo", "A: Drug X")
) %>%
mutate(
# Reorder levels of ARM to display reference arm before treatment arm.
ARM = droplevels(forcats::fct_relevel(ARM, "B: Placebo")),
is_event = CNSR == 0
)
labels <- c("ARM" = "Treatment Arm", "is_event" = "Event Flag")
formatters::var_labels(adtte_f)[names(labels)] <- labels
variables <- list(
arm = "ARM",
biomarker = "BMRKR1",
covariates = c("AGE", "BMRKR2"),
event = "is_event",
time = "AVAL"
)
# Fit default STEP models: Here a constant treatment effect is estimated in each subgroup.
step_matrix <- fit_survival_step(
variables = variables,
data = adtte_f
)
dim(step_matrix)
head(step_matrix)
# Specify different polynomial degree for the biomarker interaction to use more flexible local
# models. Or specify different Cox regression options.
step_matrix2 <- fit_survival_step(
variables = variables,
data = adtte_f,
control = c(control_coxph(conf_level = 0.9), control_step(degree = 2))
)
# Use a global model with cubic interaction and only 5 points.
step_matrix3 <- fit_survival_step(
variables = variables,
data = adtte_f,
control = c(control_coxph(), control_step(bandwidth = NULL, degree = 3, num_points = 5L))
)
Run the code above in your browser using DataLab