| logrankSingleEExact | R Documentation |
Helper function computes single component of the exact logrank e-value
logrankSingleEExact(obs0, obs1, y0, y1, thetaS, theta0 = 1, ...)
obs0 |
integer, number of observations in the control group. |
obs1 |
integer, number of observations in the treatment group. |
y0 |
integer, total number of participants in the control group. |
y1 |
integer, total number of participants in the treatment group. |
thetaS |
numeric > 0 represents the savi test defining (GROW) alternative
hypothesis obtained from |
theta0 |
numeric > 0 represents the null hypothesis. Default theta0=1. |
... |
further arguments to be passed to or from methods. |
Returns a list containing at least the following components:
Log likelihood of Fisher's hypergeometric at the null
Log likelihood of Fisher's hypergeometric at the alternative
Log likelihood of Fisher's hypergeometric at 1/alternative
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.
#'
y0Vector <- c(5, 4, 3, 3, 2, 1)
y1Vector <- c(5, 5, 4, 2, 2, 0)
obs0Vector <- c(1, 1, 0, 1, 0, 1)
obs1Vector <- c(0, 0, 1, 0, 1, 0)
logEValueGreater <- logEValueLess <- vector("numeric", length(y0Vector))
for (i in seq_along(y0Vector)) {
tempResult <- logrankSingleEExact(obs0=obs0Vector[i], obs1=obs1Vector[i],
y0=y0Vector[i], y1=y1Vector[i],
thetaS=0.7, theta0=1)
logEValueLess[i] <- tempResult[["logEValueLess"]]
logEValueGreater[i] <- tempResult[["logEValueGreater"]]
}
eValueLess <- exp(sum(logEValueLess))
eValueLess #1.116161
eValueGreater <- exp(sum(logEValueGreater))
eValueGreater # 0.7665818
eValue <- 1/2*eValueLess + 1/2*eValueGreater
eValue # 0.9413714
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.