# Vector Autoregressive Structure

**URL:** <https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862>\
**Category:** brms\
**Tags:** brms, techniques\
**Created:** [January 22, 2026, 11:35pm UTC](https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862 "2026-01-22T23:35:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cMiIIer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/cmiiier/32/20744_2.png) [@cMiIIer](https://discourse.mc-stan.org/u/cMiIIer)\
**Post date:** [January 22, 2026, 11:35pm UTC](https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862/1 "2026-01-22T23:35:26Z")

</div>

Hello!

As part of my thesis, I conducted a mesocosm experiment using a community of organisms and we are curious about how the community we curated performed. As a part of it I am trying to fit each trophic level into a model and combine them into structural equation model. However, given that our mesocosms were measured across time, I am wanting to implement a Vector Autoregressive structure to our trophic models to see how each trophic level influences each other across time.

Is there a way to implement this using brms? I am a little new to Bayesian programming/statistics and I am coming up short in my search for solutions. Any help would be greatly appreciated!

Here is the dataset and some of the code I have been playing around with:

> **[GitHub - cMiIIer/brmsHelpQuestion](https://github.com/cMiIIer/brmsHelpQuestion)**
>
> Contribute to cMiIIer/brmsHelpQuestion development by creating an account on GitHub.

Additional specs:

- Operating System: Win 11 v. 25H2
- brms Version: 2.23.0 (on R 4.4.1)

Thank you again!

---

<div class="post-metadata">

**Author:** ![nicholasjclark](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/nicholasjclark/32/14962_2.png) [@nicholasjclark](https://discourse.mc-stan.org/u/nicholasjclark)\
**Post date:** [January 26, 2026, 2:32am UTC](https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862/2 "2026-01-26T02:32:14Z")

</div>

You can do this in `mvgam` ([Multivariate (Dynamic) Generalized Additive Models • mvgam](https://nicholasjclark.github.io/mvgam/)), which handles many of the same types of effects as `brms` while incorporating latent time series components. See the [State Space Models vignette](https://nicholasjclark.github.io/mvgam/articles/trend_formulas.html) for an example of a VAR model and how to interpret it. Some other ideas for interpretation can be found [in this blog post](https://ecogambler.netlify.app/blog/vector-autoregressions/).

---

<div class="post-metadata">

**Author:** ![cMiIIer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/cmiiier/32/20744_2.png) [@cMiIIer](https://discourse.mc-stan.org/u/cMiIIer)\
**Post date:** [January 30, 2026, 12:50am UTC](https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862/3 "2026-01-30T00:50:43Z")

</div>

Thank you so, so much! Seeing how this is built on brms… is there any backwards compatibility for SEM modeling? Or does the package support it itself?

---

<div class="post-metadata">

**Author:** ![nicholasjclark](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/nicholasjclark/32/14962_2.png) [@nicholasjclark](https://discourse.mc-stan.org/u/nicholasjclark)\
**Post date:** [January 31, 2026, 10:49am UTC](https://discourse.mc-stan.org/t/vector-autoregressive-structure/40862/4 "2026-01-31T10:49:22Z")

</div>

Not currently, unfortunately. This may be a possibility in future versions but for now you’d have to modify the auto-generated Stan code to add this capability
