computeStatsForLogrank {safestats} | R Documentation |
Computes the sufficient statistics needed to compute 'logrankSingleZ'
Description
Computes the sufficient statistics needed to compute 'logrankSingleZ'
Usage
computeStatsForLogrank(
survDataFrame,
y0Index,
y1Index,
timeNow,
timeBefore,
survType = "right",
...
)
Arguments
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. |
Value
Returns a list containing at least the following components:
- obs0
number of observations in the control group.
- obs1
number of observations in the treatment group.
- y0
total number of participants in the control group.
- y1
total number of participants in the treatment group.
#'
Examples
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)
[Package safestats version 0.8.7 Index]