Accessing values of the association variable generated by joint models

Is there any way to access the values of the association variables that are generated by the longitudinal submodels (e.g. etavalue, etaauc etc.) that link these models and the event submodel? For example, could you look at a specific attribute of the fitted stan_jm() object to get the predicted ‘etaauc’ values of each subject in the event model that is used to estimate the association parameter? Thank you for any replies in advance!

1 Like

I am not sure I understand the question completely, but wouldn’t posterior_traj in combination with the posterior for the eta params give you this?. In any case - the fitted model should have all you need, the question is only how difficult it is to access.

1 Like

Yes @martinmodrak, it would be possible to obtain the values using posterio_traj, I was just wondering if they are also directly stored as an attribute within the fit object. Thank you for your input!

If I understand your questions correctly - you are using the area under the curve association option ? There isn’t a per-individual estimate of etaauc in this situation, only a group estimate. In joint models only models with shared association structures will have individual level random effects in both models.


Oh, I meant the covariate value for ‘etaauc’ not the coefficient. Meaning the predicted auc for the each subject at the time of censoring OR the event.

1 Like

Well that couldn’t be stored in the fit, because the value of auc will depend on the data fed into the prediction. But I’m afraid I know (a little) more about joint models than I do specifically about stan_jm, so I don’t know how to generate that data as a prediction - sorry! Someone else may


Hi @clairvoyant. So the only place I think they would be stored would be in the draws for the rstan fit. Those are accessed using the extraction functions like as.matrix() I think. I think you can call those extraction functions either on the returned stan_jm object (i.e. the fitted model object) or the stanfit object, something like as.matrix(my_model$stanfit) (untested, just typing this on my phone).

But to be honest I don’t think the information you are after will be in the saved draws. It is evaluated in the model block here and so I think is never stored as a parameter or transformed parameter. And even if it was, it is evaluated at a set of quadrature points that are specific to each individual based on their event time, so unpacking the meaning of it all would be a bit of work.

It’s probably easier to recreate the values you are interested in using a prediction function like posterior_traj like was suggested by @martinmodrak. But I can’t remember off the top of my head whether posterior_traj allows you to get the auc or not.

Hope that helps! 🙂


Thank you so much @sambrilleman , yes I believe the easiest way to get this information (or rather re-create it as you said) is posterior_traj. It doesn’t have the auc values readily available but it should be fairly easy to calculate it from the values returned by the function.