Linking predicted value from y2 into a downstream model y3

35 views
Skip to first unread message

Borizook

unread,
Aug 21, 2025, 1:43:09 AMAug 21
to R-inla discussion group
Dear all,

I’m trying to build a joint Bayesian model with the following structure:

- y₁ ~ formula₁ + spatial_effect  
- y₂ ~ formula₂ + spatial_effect  # shares the same spatial latent field as y₁  
- y₃ ~ y₂ × values + β

Where:  
- `values` is a known covariate 
- y₂ is a **latent quantity** estimated from the second model.

My goal is to model this jointly, so that the uncertainty in y₂ is properly propagated into y₃.

So my questions are:

Is there a way to implement this structure in INLA, inlabru, or inlamemi (e.g., via zero-trick or other workaround)?  

Any suggestions or references would be greatly appreciated!

Thanks,  
Jun-Sik LIM

Finn Lindgren

unread,
Aug 21, 2025, 1:57:58 AMAug 21
to Borizook, R-inla discussion group
From your text, it sounds like it’s not y2 itself that you want in the predictor for y3, but rather the predictor expression from the y2 model? If that’s not what you meant, you need to give more details on the intended mathematical definition of your model.

There are ways to do this with tricks, but also with inlabru.
For the y3 model, simply include the same predictor expression from y2 into your expression for y3. I can write more after you confirm more precisely what model you intend.
Finn

On 21 Aug 2025, at 06:43, Borizook <sgj...@gmail.com> wrote:

Dear all,
--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/r-inla-discussion-group/660bed94-01bd-41b1-887e-605d5c0ef431n%40googlegroups.com.
Message has been deleted
Message has been deleted

Borizook

unread,
Aug 21, 2025, 6:51:19 AMAug 21
to R-inla discussion group
  Yes exactly. You are right.
I want to use linear predictor expression from y2 model in y3 model, and multiply it with value which is a known covariate.!
How could I implement this in inlabru?



Thanks
Best

Jun-Sik LIM

Borizook

unread,
Aug 21, 2025, 6:51:30 AMAug 21
to R-inla discussion group
Yes.
More precisely, I want to use the predicted linear predictor (η) from the model, projected into a new spatial area, as an input to the model — specifically, to multiply it by a known covariate (value).  

Thanks
Best

Jun-Sik LIM

On Thursday, August 21, 2025 at 1:57:58 PM UTC+8 Finn Lindgren wrote:

Finn Lindgren

unread,
Aug 21, 2025, 7:28:18 AMAug 21
to R-inla discussion group
I'll assume a model of the form
  eta1 = beta1 * covar1 + field
  eta2 = beta2 * covar2 + field
  eta3 = eta2 * covar3 + beta4 * covar4
where beta1, beta2, beta4 and the field are latent variables and a latent field, and covar1,covar2,covar3, and covar4 are known covariates.

(It's not clear what your "beta" in your y3 model was supposed to be; I assumed another covariate; the principle is the same if it's something else)

bru(~ 0 + covar1 + covar2 + covar4 + field(geometry, model = matern_model_object),
  c(
    Model1 = bru_obs(y1 ~ covar1 + field, data = data1),
    Model2 = bru_obs(y2 ~ covar2 + field, data = data2),
    Model3 = bru_obs(y3 ~ (covar2 + field) * covar3 + covar4, data = data3)
  )
)

This assumes data3 contains the values of the covar3 covariate, and it will estimate the beta1, beta2, beta4 coefficients, and the field.

Finn



--
Finn Lindgren
email: finn.l...@gmail.com
Reply all
Reply to author
Forward
0 new messages