| Title: | Multiple Survival Crossing Curves Tests |
|---|---|
| Description: | Tests of comparison of two or more survival curves. Allows for comparison of more than two survival curves whether the proportional hazards hypothesis is verified or not. |
| Authors: | Hugo MINA PASSI [aut, cre, cph], Olayidé BOUSSARI [aut] |
| Maintainer: | Hugo MINA PASSI <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.2 |
| Built: | 2026-05-26 08:15:54 UTC |
| Source: | https://github.com/hminp/mscct |
This dataframe represents a simulation of a study where the three survival curves cross each other.
data_not_PHdata_not_PH
data_not_PHA data frame with 600 rows and 3 columns:
Time of events in months with truncation at 60 months
Indicator of censorship. 1 denotes an event, 0 denotes a censor
Integer from 0 to 2. Indicates the group the patient belongs to
This dataframe represents a simulation of a study under the Proportional Hazards hypothesis. All three survival curves follows an exponential distribution with different parameters.
data_under_PHdata_under_PH
data_under_PHA data frame with 600 rows and 3 columns:
Time of events in months with truncation at 60 months
Indicator of censorship. 1 denotes an event, 0 denotes a censor
Integer from 0 to 2. Indicates the group the patient belongs to
Performs a global log-rank test for comparing two or more survival curves.
multi_lr(df, weights, test = c("lr", "gw", "fh"), rho = 1, gamma = 0)multi_lr(df, weights, test = c("lr", "gw", "fh"), rho = 1, gamma = 0)
df |
A data frame with columns :
|
weights |
An object that can be coerced to a matrix. The weights used for the tests. Can be omitted (see Details); |
test |
If |
rho, gamma
|
The parameters for Flemming-Harrington test. Default is (rho,gamma)=(1,0), which is also called the Peto-Peto test. |
weights contains the chosen weights for the test. It must be a vector, a matrix
or an object that can be coerced to a matrix, like a data frame (passed as
argument to as.matrix). Can be omitted.
If not given (default), then perform either a log-rank test, a Gehan-Wilcoxon
test or a Fleming-Harrington test depending on the choice of test.
If weights is a one-dimension vector, its length must be equal to the
number of distinct time of event and throws an error if it is not true. In this
case, multi_lr() performs a weighted log-rank test with the specified weights.
If weights is a matrix (or a two-dimension object), its number of rows
must be equal to the number of distinct time of event and throws an error if
it is not true. In this case, multi_lr() performs as many tests as the
number of columns in weights. The first test is a weighted log-rank test
with weights the first column of weights, the second test is a weighted
log-rank test with weights the second column of weights, and so on.
An object of class multi_lr containing:
U : Statistics of tests;
p : The corresponding p-values;
degree : Degrees of freedom of the statistics of tests;
The argument test, changed to "chosen" if weights are given.
# Log-rank test multi_lr(data_not_PH) # Gehan-Wilcoxon test multi_lr(data_not_PH, test="gw") # It is possible to run several tests with different weights at a time evt_time = unique(data_not_PH$time[data_not_PH$status == 1]) nb_evt_time = length(evt_time) weights = matrix(runif(nb_evt_time*3), ncol=3) multi_lr(data_not_PH, weights=weights)# Log-rank test multi_lr(data_not_PH) # Gehan-Wilcoxon test multi_lr(data_not_PH, test="gw") # It is possible to run several tests with different weights at a time evt_time = unique(data_not_PH$time[data_not_PH$status == 1]) nb_evt_time = length(evt_time) weights = matrix(runif(nb_evt_time*3), ncol=3) multi_lr(data_not_PH, weights=weights)
Performs the test of Restricted Mean Survival Time for two or more survival curves by comparing the difference of areas under survival curves.
multi_rmst(df, tau, method = p.adjust.methods, nboot = 500)multi_rmst(df, tau, method = p.adjust.methods, nboot = 500)
df |
A dataframe with columns :
|
tau |
The truncation time, default is the lowest of the max(time) of the groups; |
method |
The correction used for the p-values. Must be in p.adjust.methods. Default is the Holm correction. Unused if number of groups equals two. |
nboot |
Number of bootstrap samples; |
For each group, the Restricted Mean Survival Time at time tau (RMST(tau)) is computed as the area under the survival curve between time 0 and tau. The test of RMST is a pairwise multiple comparison test. For each pair of groups, it tests whether the difference between the RMST(tau) is zero or not. If the difference is not null, then the survival curves cannot be equal.
For exactly two groups, a single test is performed. For more than two survival curves, it compares each survival curve to every other curves and tests the global null hypothesis "all curves are equal" against the hypothesis "the curves are not all equal".
An object of class multi_rmst containing :
rmst_mat RMST estimation for each arm;
results A matrix. Each row represents a comparison of two curves and contains the difference
of RMST, its standard deviation, the p-value and the adjusted p-value;
p The p-value of the global test;
nb_tests The number of performed tests;
The parameters tau, method and nboot.
Royston, P., & Parmar, M. K. (2013). Restricted mean survival time: an alternative to the hazard ratio for the design and analysis of randomized trials with a time-to-event outcome. BMC medical research methodology, 13, 1-15.
multi_rmst(data_under_PH, tau = 36, nboot = 300) multi_rmst(data_not_PH, tau = 36, method = "BH", nboot = 300)multi_rmst(data_under_PH, tau = 36, nboot = 300) multi_rmst(data_not_PH, tau = 36, method = "BH", nboot = 300)
Performs a two-stage test for each pair of survival curves and apply a correction in case of several comparisons.
multi_ts(df, method = p.adjust.methods, eps = 0.1, nboot = 100)multi_ts(df, method = p.adjust.methods, eps = 0.1, nboot = 100)
df |
A dataframe with columns :
|
method |
The correction used for the p-values. Must be in p.adjust.methods. Default is the Holm correction. Unused if number of groups equals two. |
eps |
A number such that 0 < |
nboot |
A positive integer, number of bootstrap sample for the second stage; |
For a two-stage test, the first stage is a log-rank test. If the first test is significant, then the whole procedure stops and we conclude that the survival curves are different. If it is not significant, then the survival curves are either equal or crossing each other and the log-rank test can't conclude the difference. A second test is performed to distinguish these two cases.
For multiple curves comparison, the two-stage test is a pairwise test. A two-stage test is performed for each pair of curves.
An object of class multi_ts containing:
results : A matrix. Each row represents a comparison of two curves and contains
the p-values for both stage, the global p-value and the adjusted global p-value;
p : The p-value for the global test;
nb_tests : The number of performed Two-Stage tests;
the parameters eps, method and nboot.
Qiu, P., & Sheng, J. (2008). A two-stage procedure for comparing hazard rate functions. Journal of the Royal Statistical Society Series B: Statistical Methodology, 70(1), 191-208. Chen, Zhongxue & Huang, Hanwen & Qiu, Peihua. (2017).
Chen, Z., Huang, H., & Qiu, P. (2017). An improved two-stage procedure to compare hazard curves. Journal of Statistical Computation and Simulation, 87(9), 1877-1886.
# test with a quarter of the data frame data_not_PH ind = c(1:100, 401:500, 801:900) multi_ts(data_not_PH[ind,], method = "BH", eps = 0.1, nboot = 10)# test with a quarter of the data frame data_not_PH ind = c(1:100, 401:500, 801:900) multi_ts(data_not_PH[ind,], method = "BH", eps = 0.1, nboot = 10)
Print method for the multiple log-rank test
## S3 method for class 'multi_lr' print(x, ...)## S3 method for class 'multi_lr' print(x, ...)
x |
An object of class |
... |
For compatibility with the |
None
x = multi_lr(data_not_PH) print(x)x = multi_lr(data_not_PH) print(x)
Print method for the multiple test of RMST
## S3 method for class 'multi_rmst' print(x, ...)## S3 method for class 'multi_rmst' print(x, ...)
x |
An object of class |
... |
For compatibility with the |
None
x = multi_rmst(data_under_PH, tau = 36, nboot = 300) print(x)x = multi_rmst(data_under_PH, tau = 36, nboot = 300) print(x)
Print method for the multiple Two-Stage test
## S3 method for class 'multi_ts' print(x, ...)## S3 method for class 'multi_ts' print(x, ...)
x |
An object of class |
... |
For compatibility with the |
None
# test with a quarter of the data frame data_not_PH ind = c(1:100, 401:500, 801:900) x = multi_ts(data_not_PH[ind,], method = "BH", eps = 0.1, nboot = 10) print(x)# test with a quarter of the data frame data_not_PH ind = c(1:100, 401:500, 801:900) x = multi_ts(data_not_PH[ind,], method = "BH", eps = 0.1, nboot = 10) print(x)