TTOT_fun {DTEBOP2} | R Documentation |
Compute the Total Time-on-Test (TTOT) Statistic
Description
Calculates the Total Time-on-Test (TTOT) statistic for a given vector of event times and censoring indicators. The TTOT function is commonly used in survival analysis for visualizing and assessing the cumulative hazard or comparing survival patterns between groups.
Usage
TTOT_fun(data, tA = 0, tB = 10000, t)
Arguments
data |
A data frame containing the input survival data.
The first column should be named |
tA |
Numeric. The starting time point for computing the Total Time-on-Test (TTOT) function. |
tB |
Numeric. The ending time point for computing the TTOT function. |
t |
Numeric. The time point(s) at which the TTOT function is evaluated. |
Value
This function calculates the total time-on-test (TTOT) for a given dataset within the time interval (tA,tB).
Examples
# Generate sample survival data
set.seed(123)
sim_time <- generate_pe(n = 20, t = 1, lambda1 = 1, lambda2 = 0.5)
sim_status <- sample(c(0, 1), 20, replace = TRUE)
Data <- data.frame(Time = sim_time, Status = sim_status)
# Compute TTOT when time = 1
TTOT_fun(Data, t = 1)