Skip to contents

Magirr and Burman (2019) have proposed a weighted logrank test to have better power than the logrank test when the treatment effect is delayed, but to still maintain good power under a proportional hazards assumption. In Magirr (2021), (the equivalent of) a maximum weight was proposed as opposed to a fixed time duration over which weights would increase. The weights for some early interval specified by the user are the inverse of the combined treatment group empirical survival distribution; see details. After this initial period, weights are constant at the maximum of the previous weights. Another advantage of the test is that under strong null hypothesis that the underlying survival in the control group is greater than or equal to underlying survival in the experimental group, Type I error is controlled as the specified level.

Usage

wMB(x, delay = 4, wmax = Inf)

Arguments

x

a counting_process-class tibble with a counting process dataset

delay

The initial delay period where weights increase; after this, weights are constant at the final weight in the delay period

wmax

Maximum weight to be returned. set delay = Inf, wmax = 2 to be consistent with recommendation of Magirr (2021).

Value

a vector with weights for the Magirr-Burman weighted logrank test for the data in x

Details

This function computes Magirr-Burman weights and adds them to a dataset created by the counting_process() function. These weights can then be used to compute a Z-statistic for the modestly weighted logrank test proposed.

We define \(t^*\) to be the input variable delay. This specifies an initial period during which weights increase. We also set a maximum weight \(w_max\). To define specific weights, we let \(S(t)\) denote the Kaplan-Meier survival estimate at time \(t\) for the combined data (control plus experimental treatment groups). The weight at time \(t\) is then defined as $$w(t)=\min(w_max, S(\min(t,t^*))^{-1}).$$

References

Magirr, Dominic, and Carl‐Fredrik Burman. "Modestly weighted logrank tests." Statistics in Medicine 38.20 (2019): 3782--3790.

Magirr, Dominic. "Non‐proportional hazards in immuno‐oncology: Is an old perspective needed?" Pharmaceutical Statistics 20.3 (2021): 512--527.

Examples

library(tidyr)
library(dplyr)

# Use default enrollment and event rates at cut at 100 events
# For transparency, may be good to set either `delay` or `wmax` to Inf`
x <- simPWSurv(n = 200) %>%
  cut_data_by_event(125) %>%
  counting_process(arm = "Experimental")

# example 1
# compute Magirr-Burman weights with `delay = 6`
ZMB <- x %>%
  wMB(delay = 6, wmax = Inf) %>%
  summarize(S = sum(o_minus_e * wMB),
            V = sum(var_o_minus_e * wMB^2),
            Z = S / sqrt(V))

# Compute p-value of modestly weighted logrank of Magirr-Burman
pnorm(ZMB$Z)
#> [1] 0.005740326

# example 2
# Now compute with maximum weight of 2 as recommended in Magirr, 2021
ZMB2 <- x %>%
  wMB(delay = Inf, wmax = 2) %>%
  summarize(S = sum(o_minus_e * wMB),
            V = sum(var_o_minus_e * wMB^2),
            Z = S / sqrt(V))

# Compute p-value of modestly weighted logrank of Magirr-Burman
pnorm(ZMB2$Z)
#> [1] 0.006180944