Skip to contents

[Stable]

This fits the Subgroup Treatment Effect Pattern logistic regression models for a binary (response) outcome. The treatment arm variable must have exactly 2 levels, where the first one is taken as reference and the estimated odds ratios are for the comparison of the second level vs. the first one.

The (conditional) logistic regression model which is fit is:

response ~ arm * poly(biomarker, degree) + covariates + strata(strata)

where degree is specified by control_step().

Usage

fit_rsp_step(variables, data, control = c(control_step(), control_logistic()))

Arguments

variables

(named list of character)
list of analysis variables: needs response, arm, biomarker, and optional covariates and strata.

data

(data.frame)
the dataset containing the variables to summarize.

control

(named list)
combined control list from control_step() and control_logistic().

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.

Note

For the default degree 0 the biomarker variable is not included in the model.

See also

control_step() and control_logistic() for the available customization options.

Examples

# Testing dataset with just two treatment arms.
library(survival)
library(dplyr)

adrs_f <- tern_ex_adrs %>%
  filter(
    PARAMCD == "BESRSPI",
    ARM %in% c("B: Placebo", "A: Drug X")
  ) %>%
  mutate(
    # Reorder levels of ARM to have Placebo as reference arm for Odds Ratio calculations.
    ARM = droplevels(forcats::fct_relevel(ARM, "B: Placebo")),
    RSP = case_when(AVALC %in% c("PR", "CR") ~ 1, TRUE ~ 0),
    SEX = factor(SEX)
  )

variables <- list(
  arm = "ARM",
  biomarker = "BMRKR1",
  covariates = "AGE",
  response = "RSP"
)

# Fit default STEP models: Here a constant treatment effect is estimated in each subgroup.
# We use a large enough bandwidth to avoid too small subgroups and linear separation in those.
step_matrix <- fit_rsp_step(
  variables = variables,
  data = adrs_f,
  control = c(control_logistic(), control_step(bandwidth = 0.5))
)
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
dim(step_matrix)
#> [1] 39 11
head(step_matrix)
#>      Percentile Center Percentile Lower Percentile Upper Interval Center
#> [1,]             0.025                0            0.525        1.472755
#> [2,]             0.050                0            0.550        2.028546
#> [3,]             0.075                0            0.575        2.204086
#> [4,]             0.100                0            0.600        2.799776
#> [5,]             0.125                0            0.625        2.969998
#> [6,]             0.150                0            0.650        3.149068
#>      Interval Lower Interval Upper  n    logor       se   ci_lower ci_upper
#> [1,]      0.4459546       6.057928 75 1.230538 1.185904 -1.0937914 3.554868
#> [2,]      0.4459546       6.371236 78 1.244538 1.183795 -1.0756577 3.564734
#> [3,]      0.4459546       6.701030 82 1.302066 1.182851 -1.0162794 3.620411
#> [4,]      0.4459546       6.886642 85 1.361186 1.182169 -0.9558222 3.678194
#> [5,]      0.4459546       7.026219 89 1.231372 1.179518 -1.0804407 3.543184
#> [6,]      0.4459546       7.144031 92 1.242238 1.180350 -1.0712045 3.555681

# Specify different polynomial degree for the biomarker interaction to use more flexible local
# models. Or specify different logistic regression options, including confidence level.
step_matrix2 <- fit_rsp_step(
  variables = variables,
  data = adrs_f,
  control = c(control_logistic(conf_level = 0.9), control_step(bandwidth = 0.6, degree = 1))
)
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings

# Use a global constant model. This is helpful as a reference for the subgroup models.
step_matrix3 <- fit_rsp_step(
  variables = variables,
  data = adrs_f,
  control = c(control_logistic(), control_step(bandwidth = NULL, num_points = 2L))
)

# It is also possible to use strata, i.e. use conditional logistic regression models.
variables2 <- list(
  arm = "ARM",
  biomarker = "BMRKR1",
  covariates = "AGE",
  response = "RSP",
  strata = c("STRATA1", "STRATA2")
)

step_matrix4 <- fit_rsp_step(
  variables = variables2,
  data = adrs_f,
  control = c(control_logistic(), control_step(bandwidth = 0.6))
)
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings
#> Warning: Fit warnings occurred, please consider using a simpler model, or larger `bandwidth`, less `num_points` in `control_step()` settings