Using a random effect from one function as a predictor in another function?

I’m fielding a query from a colleague who is interested in modeling survivorship over time as a function of a latent trait that is estimated as a random effect.

As an example, imagine that we first estimate the latent ability of person j in the context of an item-response model. Estimated as a random effect in rstan, can that θ then be inserted into a likelihood function predicting survivorship (as a discrete-time event history model). Using brms code for shorthand (and excluding other predictors), that model would look something like:

brm (survival ~ theta[j], family = bernoulli)

where “theta” is the random effect for person j.

This modeling strategy would put a beta parameter on theta[j], which is not something I have seen often. Are there pitfalls to this approach?

(This assumes that the IRT model and the event history model are estimated simultaneously in the context of a single rstan model.)

@jeremy.koster Did you ever try this, or figure out an alternative? I’m in a similar situation: we use clinical scales to estimate the latent trait, and we are interested in the neuroimaging correlate of the latent trait. We cannot do something like

brm(score ~ ...+(1|p|id), imaging_variable ~ ... + (1|p|id) ...

because the person level variation in imaging is likely due to many factors unrelated to the latent trait.

Hi @HugoBotha,

We ended up implementing this approach in this paper:

The data and code for that analysis are here:

We’d welcome feedback and suggestions. Thanks much!


That is what I had in mind and seeing your implementation is extremely helpful, thank you so much

1 Like