Closed berithunsdieck closed 8 months ago
The following code illustrates how to calculate the log baseline hazard at the time points t0
:
library("JMbayes2")
pbc2.id$status2 <- as.numeric(pbc2.id$status != 'alive')
CoxFit <- coxph(Surv(years, status2) ~ sex, data = pbc2.id)
fm <- lme(log(serBilir) ~ year * sex, data = pbc2, random = ~ year | id)
jointFit <- jm(CoxFit, fm, time_var = "year")
t0 <- c(3, 5, 7)
W0 <- splineDesign(jointFit$control$knots[[1]], t0,
ord = jointFit$control$Bsplines_degree + 1)
log_base_hazard <- c(W0 %*% jointFit$statistics$Mean$bs_gammas)
log_base_hazard
I want to dig deeper into the risk calculation since my results do not seem to be correct. Therefore I already extracted the estimated longitudinal outcomes for a given time period by using
Is there a way the extract the estimated baseline hazard given the model "model_1" for the same time period?