View source: R/fit_survival_step.R
fit_survival_step | R Documentation |
This fits the subgroup treatment effect pattern (STEP) models for a survival outcome. The treatment arm variable must have exactly 2 levels, where the first one is taken as reference and the estimated hazard ratios are for the comparison of the second level vs. the first one.
The model which is fit is:
Surv(time, event) ~ arm * poly(biomarker, degree) + covariates + strata(strata)
where degree
is specified by control_step()
.
fit_survival_step(
variables,
data,
control = c(control_step(), control_coxph())
)
variables |
(named |
data |
( |
control |
(named |
A matrix of class step
. The first part of the columns describe the subgroup intervals used
for the biomarker variable, including where the center of the intervals are and their bounds. The
second part of the columns contain the estimates for the treatment arm comparison.
For the default degree 0 the biomarker
variable is not included in the model.
control_step()
and control_coxph()
for the available customization options.
# 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))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.