| computeLogrankZ | R Documentation |
This function was created to complement survdiff from the
'survival' package, which is restricted to 'Surv' objects of type "right". Most likely
survdiff is much faster
computeLogrankZ(
survObj,
group,
computeZ = TRUE,
computeExactE = FALSE,
theta0 = 1,
thetaS = NULL,
...
)
survObj |
a Surv object that is either of type |
group |
a grouping factor with 2 levels |
computeZ |
logical. If |
computeExactE |
logical. If |
theta0 |
numeric > 0 used only for the e-value, i.e., if computeExactE is |
thetaS |
numeric > 0 used only for the e-value, i.e., if computeExactE is |
... |
further arguments to be passed to or from methods. |
Returns a list containing at least the following components:
the number of events.
the observed logrank statistic.
vector of observed minus expected.
vector of hypergeometric variances.
vector at which the events occurred.
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. Schoenfeld, D. (1981). The asymptotic properties of nonparametric tests for comparing survival distributions. Biometrika, 68(1), 316-319, https://doi.org/10.2307/2335833.
data <- generateSurvData(nP = 5,
nT = 5,
lambdaP = 0.03943723,
lambdaT = 0.5*0.03943723,
endTime = 40,
seed = 2006)
survObj <- survival::Surv(data$time, data$status)
survObj <- survival::Surv(data$time, data$status)
result <- computeLogrankZ(survObj, data$group)
result$z
sqrt(survival::survdiff(survObj~data$group)$chisq)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.