calculate_statistics {bunsen} | R Documentation |
Estimate the marginal causal survival curves using potential outcome framework
Description
Estimate the marginal causal survival curves for simulating time-to-event data in a discrete manner based on the methods from Daniel et al.(2020).
Usage
calculate_statistics(model, trt)
Arguments
model |
A fitted coxph model. This should be a coxph event model or censoring model. |
trt |
Character. Name of the treatment assignment variable. |
Details
If the study period for the original data is divided into discrete windows, defined by the event times in the original data, at time t0 = 0, everyone in the simulated data is still a survivor. S(x) is the estimated survival function. By the end of the window (0,t1], a proportion S(t1) still survives. The conditional probability of surviving the next window, (t1,t2], conditional on surviving the first window, is S(t2)/S(t1), and so on. This function returns the S(t2)/S(t1) in series.
Value
Two vectors containing the marginal causal survival curves for treatment arms (1 for treatment arm; 0 for control arm/placebo). Each number is the probability of the surviving the time window (t1,t2],... conditional on surviving the prior corresponding window.
References
Daniel R, Zhang J, Farewell D. Making apples from oranges: Comparing noncollapsible effect estimators and their standard errors after adjustment for different covariate sets. Biom J. 2021;63(3):528-557. doi:10.1002/bimj.201900297
Examples
library(survival)
data("oak")
cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak)
calculate_statistics(model = cox_event, trt = "trt")