Subgroup Treatment Effect Pattern (STEP) Fit for Survival Outcome
Source:R/fit_survival_step.R
      fit_survival_step.RdThis fits the Subgroup Treatment Effect Pattern 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().
Note that for the default degree 0 the biomarker variable is not included in the model.
Usage
fit_survival_step(
  variables,
  data,
  control = c(control_step(), control_coxph())
)Arguments
- variables
 (named
listofcharacter)
list of analysis variables: needstime,event,arm,biomarker, and optionalcovariatesandstrata.- data
 (
data.frame)
the dataset containing the variables to summarize.- control
 (named
list)
combined control list fromcontrol_step()andcontrol_coxph().
Value
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.
See also
control_step() and control_coxph() for the available customization options.
Examples
# Testing dataset with just two treatment arms.
library(scda)
library(dplyr)
library(rtables)
adtte <- synthetic_cdisc_data("latest")$adtte
adtte_f <- 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)
#> [1] 39 12
head(step_matrix)
#>      Percentile Center Percentile Lower Percentile Upper Interval Center
#> [1,]             0.025                0            0.275        1.240529
#> [2,]             0.050                0            0.300        1.628805
#> [3,]             0.075                0            0.325        1.818258
#> [4,]             0.100                0            0.350        2.003407
#> [5,]             0.125                0            0.375        2.300801
#> [6,]             0.150                0            0.400        2.638651
#>      Interval Lower Interval Upper   n events       loghr        se   ci_lower
#> [1,]      0.4055982       3.504396  74     41 0.006507558 0.3163349 -0.6134975
#> [2,]      0.4055982       3.686405  81     45 0.056543290 0.3031253 -0.5375715
#> [3,]      0.4055982       3.805456  87     50 0.118428018 0.2903633 -0.4506737
#> [4,]      0.4055982       3.925492  94     55 0.152132172 0.2808143 -0.3982538
#> [5,]      0.4055982       4.121412 101     59 0.099905333 0.2715645 -0.4323514
#> [6,]      0.4055982       4.284773 107     64 0.082851772 0.2574120 -0.4216664
#>       ci_upper
#> [1,] 0.6265126
#> [2,] 0.6506581
#> [3,] 0.6875297
#> [4,] 0.7025181
#> [5,] 0.6321620
#> [6,] 0.5873699
# 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))
)