multi_lr | R Documentation |
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.