computeLogrankZ {safestats} | 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.
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)