Skip to content

FTime to event · Guide test 245

Rényi supremum survival tests

Use the largest cumulative weighted survival difference, useful when survival curves cross.

Runs in CodeSplashPython (calls R) example not runR example validated

Do it in CodeSplash

In the app, set it up in Analyze with this method:

In Log-rank test (compare survival curves), choose Compare by = Rényi supremum.

Do it in CodeSplash Run this test on your own data, in Python or R.

Bench

Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.

Bench · Rényi supremum test

40
40
1.00

Group 1's median event time divided by group 2's; 1 means equal medians.

0.50

Lognormal σ; unequal spreads make the survival curves cross.

1.50
4.0

Censoring times are uniform on (0, follow-up); group 2's median event time is 1.

0.050

Your data

Simulated with known medians and spreads
G14018100G240171261S(t)

Kaplan–Meier curves; ticks mark censored follow-up. Rows under the axis: numbers still at risk. Shaded: the weight each event time gets, w(t) = 1. Dashed: where the weighted difference in events peaks, the supremum Rényi uses.

If H₀ were true

Q = 1.74
  1. The reference: how Q varies across samples when H₀ is true, sup |B(t)| of a Brownian motion (sup of a Brownian motion on [0, 1]).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .163).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

Q=sup⁡t≤τ∣U(t)∣V(τ),U(t)=∑tj≤twj(d1j−Y1jdjYj)Q=\sup_{t\le\tau}\frac{|U(t)|}{\sqrt{V(\tau)}},\qquad U(t)=\sum_{t_j\le t}w_j\Big(d_{1j}-\frac{Y_{1j}d_j}{Y_j}\Big)

With your numbers

max⁡t∣U(t)∣=5.91 at t=0.35,V(τ)=11.50,Q=1.74\max_t|U(t)| = 5.91\ \text{at } t = 0.35,\quad V(\tau) = 11.50,\quad Q = 1.74
U(t)U(t)
the running (log-rank) score up to time t
sup⁡t\sup_t
its largest excursion, so a difference that later reverses still counts
sup⁡∣B∣\sup|B|
the reference: the largest excursion of a Brownian motion on [0, 1]

The verdict

Q = 1.74, p = .163

p > α = .050: compatible with H₀

Keeps power when curves cross, where the log-rank sum cancels. It says the curves differ somewhere, not when or in which direction.

Statistic
1.743
p-value
0.1627
Rényi supremum test on 40 + 40 subjects with 50 events: Q = 1.74, p = .163. The p-value is above α = .050, so the data are compatible with H0.

Rényi supremum test on 40 + 40 subjects with 50 events: Q = 1.74, p = .163. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: groups share the same survival distribution.

Assumptions

Independent subjects and independent/noninformative censoring within groups, conditional on the modeled design. Standard weights and variances presume the stated risk-set process. Proportional hazards is a power/interpretation condition for logrank, not necessary for validity under identical survival curves.

Formula

Q=sup⁡t≤τ∣U(t)∣V(τ)U(t)=∑tj≤twj(d1j−Y1jdj/Yj)\begin{gathered}Q=\sup_{t\le\tau}\frac{|U(t)|}{\sqrt{V(\tau)}}\\[5pt] U(t)=\sum_{t_j\le t}w_j(d_{1j}-Y_{1j}d_j/Y_j)\end{gathered}

Parameters and notation

U(t) is the cumulative weighted logrank score; V(τ) its terminal variance. Alternative Rényi versions use different variance/time normalizations.

Structure of the method

Construct a cumulative weighted survival score over event times, standardize with the declared terminal variance, and take the largest absolute excursion over the prespecified follow-up interval. This supremum avoids cancellation of early and late contributions that can make the terminal logrank score small.

Estimated and nuisance parameters

Estimate risk sets, event counts, cumulative score, and terminal covariance; the location of the largest excursion is descriptive and data-selected. No hazard ratio or fitted crossing point is automatically obtained. Other Rényi normalizations define different processes and require different reference distributions.

Settings and design choices

Choose weight rule, absolute versus directional functional, terminal time, and eligibility rule for sparse risk sets. The survMisc procedure defines a terminal time while both groups remain represented; this boundary is not interchangeable with an arbitrary maximum recorded time. Prespecify any additional trimming.

Fitting and adaptation

Use the implementation’s supremum-process calibration or a design-valid multiplier/bootstrap procedure that recomputes the entire process. For comparing several weighting rules or follow-up intervals, calibrate their joint search. Adaptation is a new process definition and reference calculation, not tuning a conventional one-time normal statistic.

Sensitivity and robustness

Inspect sparse tails, heavy censoring, crossing patterns, and unstable excursion times. A large maximum does not prove that survival curves cross; it can detect other departures. Report the cumulative path and relevant survival effects, and do not use ordinary chi-square/normal thresholds for an uncalibrated maximum over time.

How to use and calibrate

Use the supremum-of-process null distribution or a valid multiplier/bootstrap approximation matching the version.

Example application

Detect crossing survival curves whose signed logrank contributions cancel.

Interpretation and pitfalls

Watch out

Do not use a single standard normal critical value for the maximum over time. Specify the process and follow-up cutoff.

What changed in edition 2

  • New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.

Python and R

Read the supremum/Rényi output in the sup attribute, not an ordinary integrated log-rank row. The package computes several related weighted tests in one call; identify the named statistic explicitly.

Python · invokes R

Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: survMisc, survival

# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
    raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
library(survival)
n<-120;g<-factor(rep(c("A","B"),each=60));event_time<-rexp(n,rate=ifelse(g=="A",.1,.14));censor_time<-rexp(n,.04);d<-data.frame(time=pmin(event_time,censor_time),status=as.integer(event_time<=censor_time),g=g)
s<-survMisc::ten(Surv(time,status)~g,data=d)
survMisc::comp(s,p=1,q=1)
print(attributes(s)[c("lrt","tft","sup")])
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
                        text=True, capture_output=True)
print(result.stdout)
if result.stderr:
    print(result.stderr)
result.check_returncode()
R

Validated — Executed successfully in the validation environment · needs survMisc, survival

set.seed(2026)
library(survival)
n<-120;g<-factor(rep(c("A","B"),each=60));event_time<-rexp(n,rate=ifelse(g=="A",.1,.14));censor_time<-rexp(n,.04);d<-data.frame(time=pmin(event_time,censor_time),status=as.integer(event_time<=censor_time),g=g)
s<-survMisc::ten(Surv(time,status)~g,data=d)
survMisc::comp(s,p=1,q=1)
print(attributes(s)[c("lrt","tft","sup")])
Output
                    Q        Var      Z pNorm
1          7.1280e+00 1.9135e+01 1.6295     1
n          3.4900e+02 1.0664e+05 1.0687     6
sqrtN      4.5679e+01 1.2812e+03 1.2761     3
S1         3.5674e+00 8.7171e+00 1.2083     4
S2         3.4811e+00 8.4885e+00 1.1948     5
FH_p=1_q=1 1.1145e+00 6.8455e-01 1.3470     2
              maxAbsZ        Var      Q pSupBr
1          7.2708e+00 1.9135e+01 1.6621      1
n          4.8000e+02 1.0664e+05 1.4699      2
sqrtN      4.6909e+01 1.2812e+03 1.3105      6
S1         4.0187e+00 8.7171e+00 1.3611      5
S2         3.9840e+00 8.4885e+00 1.3674      4
FH_p=1_q=1 1.1806e+00 6.8455e-01 1.4270      3
$lrt
                    Q        Var      Z pNorm
1          7.1280e+00 1.9135e+01 1.6295     1
n          3.4900e+02 1.0664e+05 1.0687     6
sqrtN      4.5679e+01 1.2812e+03 1.2761     3
S1         3.5674e+00 8.7171e+00 1.2083     4
S2         3.4811e+00 8.4885e+00 1.1948     5
FH_p=1_q=1 1.1145e+00 6.8455e-01 1.3470     2

$<NA>
NULL

$sup
              maxAbsZ        Var      Q pSupBr
1          7.2708e+00 1.9135e+01 1.6621      1
n          4.8000e+02 1.0664e+05 1.4699      2
sqrtN      4.6909e+01 1.2812e+03 1.3105      6
S1         4.0187e+00 8.7171e+00 1.3611      5
S2         3.9840e+00 8.4885e+00 1.3674      4
FH_p=1_q=1 1.1806e+00 6.8455e-01 1.4270      3

Sources

Statistics guide v4 (historical):
Python: Executed end to end through Rscript · R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.

From the CodeSplash statistics guide (v4), entry 245, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT245.