## ----inference-examples------------------------------------------------------- library(cifmodeling) example_data <- data.frame( time = 1:12, status = c(1, 0, 2, 1, 2, 0, 1, 2, 0, 1, 0, 0), weight = c(1, 1.5, 0.8, 1.2, 1, 0.7, 1.3, 1, 0.9, 1.1, 1, 1) ) # AJ with IF-t and equal-allocation degrees of freedom. fit_edf <- cifcurve( Event(time, status) ~ 1, data = example_data, weights = "weight", outcome.type = "competing-risk", error = "if", conf.dist = "t", df.method = "equal", conf.type = "log-log" ) at_five <- summary(fit_edf, times = 5) data.frame( time = at_five$time, CIF = 1 - at_five$surv, SE = at_five$std.err, lower = 1 - at_five$upper, upper = 1 - at_five$lower, df = at_five$df, status = at_five$conf.status ) # KM for the composite of either event, with FG-t. fit_fg <- cifcurve( Event(time, status > 0) ~ 1, data = example_data, outcome.type = "survival", error = "fay", conf.dist = "t", conf.type = "arcsin" ) ## ----inference-plot, eval=FALSE----------------------------------------------- # cifplot(fit_edf, outcome.type = "competing-risk", add.risktable = FALSE)