library(adjustedCurves)
if (requireNamespace("cmprsk")) {
library(cmprsk)
set.seed(42)
# simulate some data as example
sim_dat <- sim_confounded_crisk(n=50, max_t=5)
sim_dat$group <- as.factor(sim_dat$group)
# calculate un-adjusted aalen-johansen estimates
adjcif <- adjustedcif(data=sim_dat,
variable="group",
ev_time="time",
event="event",
cause=1,
method="aalen_johansen")
# plot the curves
plot(adjcif)
}
Run the code above in your browser using DataLab