You possibly answered this questions before but I couldn’t find or remember your answer anymore. I hope not to bother you but is it possible in brms to use the outcome of a regression in a follow-up regression? Thus for example:
#1st step
beta0, beta1 and sd1 are parameters. X and A are data.
mu1 = beta0 + beta1 * X
A ~ normal(mu1, sd1)
#2nd step
alpha0, alpha1 and sd2 are parameters. B is data. mu1 is linear predictor from the first regression.
Thanks! I would greatly appreciate to incorporate all uncertainty. I tried to fit a non-linear model:
bf(B ~ 1 + mu1, mu1 ~ 1 + A, nl = TRUE)
but this is another model than I would like to fit.
bf(A ~ X) + bf(B ~ A) + set_rescor(TRUE)
fits the data possibly best, but I would like to use the linear predictor of bf(A ~ X) in bf(B ~ A). If this isn’t possible yet, your package is still a great help and I can adjust the stan code myself, but if this is possible with brms, I would prefer to use brms.
Thanks a lot for your suggestions! Your suggestion using “fitted” worked also quite well but in the end I think that I prefer the multivariate model and to adjust the stan code slightly as this model is the model I would like to fit. Many thanks for your help, quick responses and for creating and maintaining brms!