if (FALSE) {
library(mets)
data(bmt)
bmt$id <- seq_len(nrow(bmt))
## --- competing risks CIF/Survival (default) ---
fit <- brier_binreg(
Event(time, cause) ~ tcell + platelet + age + cluster(id),
data = bmt, time = 50,
rhs = list(small = ~age, full = ~tcell + platelet + age)
)
summary(fit) ## log scale
summary(fit, transform = exp) ## Brier scale
## multiple time points
fitm <- brier_binreg(
Event(time, cause) ~ tcell + platelet + age + cluster(id),
data = bmt, time = c(50, 60),
rhs = list(small = ~age, full = ~tcell + platelet + age)
)
summary(fitm, transform = exp)
## joint inference across models via lava::estimate
e <- estimate(fitm)
e
estimate(e, f = exp) ## back-transform
## stratified IPCW weights for Brier score
fit_strat <- brier_binreg(
Event(time, cause) ~ tcell + platelet + age + cluster(id),
data = bmt, time = 50,
rhs = list(small = ~age, full = ~tcell + platelet + age),
brier.cens.model = ~strata(tcell)
)
## --- RMST --- survival case only
fit_rmst <- brier_binreg(
Event(time, cause) ~ tcell + platelet + age + cluster(id),
data = bmt, time = 50, cause = 1:2,
rhs = list(small = ~age, full = ~tcell + platelet + age),
outcome = "rmst"
)
summary(fit_rmst, transform = exp)
## --- RMTL --- competing risks or survival (RMTL)
fit_rmtl <- brier_binreg(
Event(time, cause) ~ tcell + platelet + age + cluster(id),
data = bmt, time = 50,
rhs = list(small = ~age, full = ~tcell + platelet + age),
outcome = "rmtl"
)
summary(fit_rmtl, transform = exp)
}
Run the code above in your browser using DataLab