# ReactiveMP: How to run linear model with multiple predictors and an intercept

**URL:** https://discourse.julialang.org/t/reactivemp-how-to-run-linear-model-with-multiple-predictors-and-an-intercept/85290
**Category:** Probabilistic Programming
**Tags:** question, package, bayesian-inference, forneylab
**Created:** [August 4, 2022, 10:01am UTC](https://discourse.julialang.org/t/reactivemp-how-to-run-linear-model-with-multiple-predictors-and-an-intercept/85290 "2022-08-04T10:01:47Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![svilupp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/svilupp/32/34933_2.png) [@svilupp](https://discourse.julialang.org/u/svilupp)
#### Post date: [August 5, 2022, 12:41pm UTC](https://discourse.julialang.org/t/reactivemp-how-to-run-linear-model-with-multiple-predictors-and-an-intercept/85290/4 "2022-08-05T12:41:43Z")

</div>

Hi there,

I’d suggest reading through [Albert’s response](https://discourse.julialang.org/t/simple-linear-regression-with-reactivemp-rulemethoderror/81526/2)

So in line with that, I would try:

- add init messages for each separate node and init marginals (you can remove them later)
- take out the broadcast of sigma and create an auxiliary variable (as per Albert’s response), where you provide explicit factorization via `constraint`
- look for inspiration in the [test suite](https://github.com/biaslab/ReactiveMP.jl/blob/754e15c1b8b509ba52f337e5836a3aff5556a1a0/test/nodes/test_mv_normal_mean_covariance.jl)

But it’s all a guesswork from me, as I haven’t tried to build MvNormal. I’m not sure how the factorization between location and covariance in McNormal works in ReactiveMP, because you should use Cholesky there…

---

_[View the full topic](https://discourse.julialang.org/t/reactivemp-how-to-run-linear-model-with-multiple-predictors-and-an-intercept/85290)._
