Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

survfitJM, aucJM, prederrJM require information about the date of the event when using time-varying-effect approach #108

Open
zoubirph opened this issue Nov 16, 2024 · 3 comments

Comments

@zoubirph
Copy link

Hello,
We have modelled the link between a biological marker and the risk of an event in a time-dependent manner according to your Time-varying Effects example on the https://www.drizopoulos.com/vignettes/multivariate%20joint%20models#time-varying-effects page. i.e., we have used the equivalent of ‘Time’ instead of ‘year’, which allows us to have a wider time range and capture the change in the α(t) value in a time-dependent manner reflecting the pathophysiological reality.
However, during the external validation of the model, we noticed that the functions survfitJM, aucJM, prederrJM require information about the date of the event, which obviously biases the estimation of the model's predictive capacity and limits the application of the model for individual prediction. How can this limitation be resolved?

Thank you very much for your help and for this excellent package.

@drizopoulos
Copy link
Owner

drizopoulos commented Nov 16, 2024 via email

@zoubirph
Copy link
Author

zoubirph commented Nov 16, 2024

Thank you very much for your fast response!
I'll illustrate with an example that you used in the vignette.

library("JMbayes")
library("splines")
pbc2$Time <- pbc2$years
pbc2$event <- as.numeric(pbc2$status != "alive")

pbc2.id <- pbc2[!duplicated(pbc2$id), ]

MixedModelFit1 <- mvglmer(list(log(serBilir) ~ year + (year | id)), data = pbc2,
families = list(gaussian))
CoxFit <- coxph(Surv(Time, event) ~ drug + age, data = pbc2.id, model = TRUE)

Ints_tveffect <- list("log(serBilir)_value" = ~ 0 + tve(Time, df = 8))

JMFit1_tveffect <- mvJointModelBayes(MixedModelFit1, CoxFit, timeVar = "year",
Interactions = Ints_tveffect)

aucJM(JMFit1_tveffect, pbc2, Tstart = 5, Thoriz = 8)
prederrJM(JMFit1_tveffect, pbc2, Tstart = 5, Thoriz = 8)

ND <- pbc2[pbc2$id == 1, ]
sprobs <- survfitJM(JMFit1_tveffect, ND, M = 1000)
plot(sprobs)
###all functions work well

#######and now using pbc2_test data set without event and time of the event and you will see the following error message
#Error in Surv(Time, event) : objet 'Time' not found

pbc2_test <- pbc2[ , !(names(pbc2) %in% c("event", "Time"))]
aucJM(JMFit1_tveffect, pbc2_test, Tstart = 5, Thoriz = 8)
prederrJM(JMFit1_tveffect, pbc2_test, Tstart = 5, Thoriz = 8)

ND <- pbc2_test[pbc2_test$id == 1, ]
sprobs <- survfitJM(JMFit1_tveffect, ND, M = 1000)

plot(sprobs)

#which is not the case with a model without time varying effect particularly for the ‘survfitJM’ function

JMFit1 <- mvJointModelBayes(MixedModelFit1, CoxFit, timeVar = "year")

ND <- pbc2_test[pbc2_test$id == 2, ]
sprobs <- survfitJM(JMFit1, ND, M = 1000)

plot(sprobs)

@drizopoulos
Copy link
Owner

drizopoulos commented Nov 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants