| sampleLogrankStoppingTimes | R Documentation |
Simulate stopping times for the exact savi logrank test
sampleLogrankStoppingTimes(
hrTrue,
alpha = 0.05,
alternative = c("twoSided", "less", "greater"),
m0 = 50000L,
m1 = 50000L,
nSim = 1000L,
groupSizePerTimeFunction = returnOne,
seed = NULL,
power = NULL,
beta = NULL,
relevanceTest = FALSE,
relevanceSize = NULL,
wantEValuesAtNMax = FALSE,
wantSamplePaths = TRUE,
wantSimData = TRUE,
parameter = NULL,
nMax = Inf,
pb = TRUE,
hrMin = NULL,
...
)
hrTrue |
numeric that defines the data generating hazard ratio with which data are sampled. |
alpha |
numeric in (0, 1) that specifies the tolerable type I error and the null rejection rule e >= 1/alpha. |
alternative |
a character string specifying the alternative hypothesis, which must be one of "twoSided" (default),"greater" or "less". The alternative is pitted against the null hypothesis of equality of the survival distributions. More specifically, let lambda1 be the hazard rate of group 1 (i.e., placebo), and lambda2 the hazard ratio of group 2 (i.e., treatment), then the null hypothesis states that the hazard ratio theta = lambda2/lambda1 = 1. If alternative = "less", the null hypothesis is compared to theta < 1, thus, lambda2 < lambda1, that is, the hazard of group 2 (i.e., treatment) is less than that of group 1 (i.e., placebo), hence, the treatment is beneficial. If alternative = "greater", then the null hypothesis is compared to theta > 1, thus, lambda2 > lambda1, hence, harm. |
m0 |
Number of subjects in the control group 0/1 at the beginning of the trial, i.e., |
m1 |
Number of subjects in the treatment group 1/2 at the beginning of the trial, i.e., |
nSim |
integer > 0, the number of simulations needed to compute power or the number of events for the exact savi logrank test under continuous monitoring |
groupSizePerTimeFunction |
A function without parameters and integer output. This function provides the number
of events at each time step. For instance, if |
seed |
integer, seed number. |
power |
numeric in (0, 1) that specifies the desired power, that is, the targetted chance to stop for the alternative over the null hypothesis, when the alternative holds true. Note that prior to version 0.8.8 power <- 1-beta. This overrides the "beta" argument |
beta |
numerical in (0,1). Old parameter now replaced by the power parameter |
relevanceTest |
logical, if |
relevanceSize |
numeric, the minimal clinical relevant standardised mean difference that we do not want to miss under the alternative. Default relevanceSize=NULL implies relevanceSize=abs(meanDiffMin) |
wantEValuesAtNMax |
logical. If |
wantSamplePaths |
logical, if |
wantSimData |
logical. If |
parameter |
Numeric > 0, represents the savi tests defining thetaS. Default NULL so it's decided by the algorithm, typically, this equals hrMin, which corresponds to the GROW choice. |
nMax |
An integer. Once nEvents hits nMax the experiment terminates, if it didn't stop due to threshold crossing crossing already. Default set to Inf. |
pb |
logical, if |
hrMin |
numeric that defines the minimal relevant hazard ratio, the smallest hazard ratio that we want to detect. |
... |
further arguments to be passed to or from methods. |
a list with stoppingTimes and breakVector. Entries of breakVector are 0, 1. A 1 represents stopping due to exceeding nMax, and 0 due to 1/alpha threshold crossing, or running out of participants, which implies that the corresponding stopping time is Inf.
Muriel Felipe Perez-Ortiz and Alexander Ly
Grünwald, P. D., de Heide, R., & Koolen, W. (2024). Safe testing. Journal of the Royal Statistical Society. Series B (Methodological), 86(5), 1091-1128. (With discussions), https://doi.org/10.1093/jrsssb/qkae011. ter Schure, J., Pérez-Ortiz, M. F., Ly, A., & Grünwald, P. D. (2024). The Safe Logrank Test: Error control under continuous monitoring with unlimited horizon. The New England Journal of Statistics in Data Science, 2(2), 190-214, https://doi.org/10.51387/24-NEJSDS65.
sampleLogrankStoppingTimes(0.7, nSim=10, nMax=30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.