library(adjustedCurves)
if (requireNamespace("geepack") & requireNamespace("prodlim")) {
set.seed(42)
# simulate some data as example
sim_dat <- sim_confounded_crisk(n=30, max_t=1.3)
sim_dat$group <- as.factor(sim_dat$group)
# calculate adjusted CIFs, with time as factor
adjcif <- adjustedcif(data=sim_dat,
variable="group",
ev_time="time",
event="event",
cause=1,
method="direct_pseudo",
outcome_vars=c("x1", "x2", "x3", "x4", "x5", "x6"),
type_time="factor",
force_bounds=TRUE,
iso_reg=TRUE)
plot(adjcif)
# with time modelled as B-Spline using 5 degrees of freedom
adjcif <- adjustedcif(data=sim_dat,
variable="group",
ev_time="time",
event="event",
cause=1,
method="direct_pseudo",
outcome_vars=c("x1", "x2", "x3", "x4", "x5", "x6"),
type_time="bs",
spline_df=5,
force_bounds=TRUE,
iso_reg=TRUE)
# plot the curves
plot(adjcif)
}
Run the code above in your browser using DataLab