computeStatsForLogrank | R Documentation |
Computes the sufficient statistics needed to compute 'logrankSingleZ'
computeStatsForLogrank( survDataFrame, y0Index, y1Index, timeNow, timeBefore, survType = "right", ... )
survDataFrame |
a 'Surv' object converted to a matrix, then to a data.frame |
y0Index |
vector of integers corresponding to the control group |
y1Index |
vector of integers corresponding to the treatment group |
timeNow |
numeric, current time |
timeBefore |
numeric, previous time |
survType |
character, either "right" or "counting" (left truncated, right censored) |
... |
further arguments to be passed to or from methods. |
Returns a list containing at least the following components:
number of observations in the control group.
number of observations in the treatment group.
total number of participants in the control group.
total number of participants in the treatment group.
#'
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) survDataFrame <- as.data.frame(as.matrix(survObj)) y0Index <- which(data$group=="P") y1Index <- which(data$group=="T") timeNow <- 4 timeBefore <- 0 computeStatsForLogrank(survDataFrame, y0Index, y1Index, timeNow, timeBefore) timeNow <- 13 timeBefore <- 4 computeStatsForLogrank(survDataFrame, y0Index, y1Index, timeNow, timeBefore)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.