# STAN for large model with a lot of parameter

**URL:** <https://discourse.mc-stan.org/t/stan-for-large-model-with-a-lot-of-parameter/4590>\
**Category:** General\
**Tags:** performance\
**Created:** [June 20, 2018, 11:15pm UTC](https://discourse.mc-stan.org/t/stan-for-large-model-with-a-lot-of-parameter/4590 "2018-06-20T23:15:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tianjie\_Wang](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@Tianjie\_Wang](https://discourse.mc-stan.org/u/Tianjie_Wang)\
**Post date:** [June 20, 2018, 11:15pm UTC](https://discourse.mc-stan.org/t/stan-for-large-model-with-a-lot-of-parameter/4590/1 "2018-06-20T23:15:06Z")

</div>

I encounter a job that involve a very large hierarchical model (around 40k parameters and 1m samples). We used to code them in rJAGS and it took long to converge. We recently recoded it in rstan, it seems that it is doing worse in stan.  
Is it ture that stan preferably to fit a comparatively small model (less p) and not work well in a very big one?  
Thanks,  
TJ

---

<div class="post-metadata">

**Author:** ![mike-lawrence](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mike-lawrence/32/59_2.png) [@mike-lawrence](https://discourse.mc-stan.org/u/mike-lawrence)\
**Post date:** [June 20, 2018, 11:27pm UTC](https://discourse.mc-stan.org/t/stan-for-large-model-with-a-lot-of-parameter/4590/2 "2018-06-20T23:27:44Z")

</div>

No, that is not true in general. Post your code and you might get some pointers as to what might be awry.

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [June 21, 2018, 11:42pm UTC](https://discourse.mc-stan.org/t/stan-for-large-model-with-a-lot-of-parameter/4590/3 "2018-06-21T23:42:13Z")

</div>

> [@Tianjie\_Wang](#):
>
> Is it ture that stan preferably to fit a comparatively small model (less p) and not work well in a very big one?

Exactly the opposite if you look at relative performance compared to other tools.

You want to compare effective sample size adjusting for convergence, not just iteration speed.
