Predicting outside of follow-up time with JMBayes2

46 Views Asked by At

I am trying to work with the JMBayes2 package to simulate outcomes outside of my datarange for a problem where I have a longitudinal outcome which forms a proxy for cognitive functioning and a binary outcome which indicates a ‘state-change’ in cognitive functioning. I run into two problems while doing this.

  1. I cannot work out how to extract the baseline hazard the joint model JMBayes2 generates. Based on the github code of the package it seems to always use a spline, but I cannot figure out how to extract the information. Within the joint-model-object under $statistics the bs_gammas seem to relate to the spline over the baseline hazard, but I don't know to determine the baseline hazard from the provided information. With the spline equation I could try to generate the survival probabilities myself.
  2. The predict.jm function does not seem to give a prediction outside of the maximum datarange of the data used to built the model.

Solving either problem would help me to generate long term predictions.

Example based on example code provided alongside the JMbayes2 package:

library(JMbayes2)
library(dplyr)
pbc2$years %>% max ##maximum follow-up is 14.3 yhears
pbc2.id$status2 <- as.numeric(pbc2.id$status != 'alive')
SurvFit <- survreg(Surv(years, status2) ~ sex, data = pbc2.id, dist = "weibull")
fm1 <- lme(log(serBilir) ~ ns(year, 3) * sex, data = pbc2,
           random = ~ ns(year, 3) | id, control = lmeControl(opt = 'optim'))

jointFit <- jm(CoxFit, fm1, time_var = "year")

##selecting patients from the pbc data for which I want a prediction
t0 <- 3
ND <- pbc2[pbc2$id %in% c(2, 25), ]
ND <- ND[ND$year < t0, ]
ND$status2 <- 0
ND$years <- t0

# predictions for the longitudinal outcomes using newdata
predLong1 <- predict(jointFit, newdata = ND, return_newdata = TRUE
                     , process = "event"
                     , times = 14:15 ##one datapoint before the maximum follow-up, one after
                     )
predLong1 %>% dplyr::select(id, year, pred_CIF)

With predLong1 showing this output not including the 15th year of requested follow-up:

      id year  pred_CIF
6      2    3 0.0000000
6.1    2   14 0.5943413
171   25    3 0.0000000
171.1 25   14 0.2668998

As a sidenote: I would prefer for the joint model to use some parametric baseline hazard distribution, but even when I specify a weibull distribution in the input survival model, JMbayes2 seems to generate a spline.

0

There are 0 best solutions below