# Improving the efficiency of fitting a model using stan\_lmer

**URL:** <https://discourse.mc-stan.org/t/improving-the-efficiency-of-fitting-a-model-using-stan-lmer/14237>\
**Category:** rstanarm\
**Tags:** rstanarm, performance, fitting-issues\
**Created:** [April 11, 2020, 12:13am UTC](https://discourse.mc-stan.org/t/improving-the-efficiency-of-fitting-a-model-using-stan-lmer/14237 "2020-04-11T00:13:17Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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:** [April 12, 2020, 12:05pm UTC](https://discourse.mc-stan.org/t/improving-the-efficiency-of-fitting-a-model-using-stan-lmer/14237/7 "2020-04-12T12:05:14Z")

</div>

If you feel up to delving into coding in Stan directly, you might get a speed up by using the trick [posted here](https://discourse.mc-stan.org/t/case-study-preview-speeding-up-stan-by-reducing-redundant-computation/14228). The mapping from that example’s terminology to yours is subject==job, you’ll want to use the formula “~ male+seniority” for the W matrix and “~1” for the B matrix.

I can’t recall if stan\_lmer defaults to a centered or non-centered parameterization, but the example uses non-centered. You might also check if your W matrix has much correlation, and if so use the QR reparameterization from the manual (which I do think stan\_lmer applies by default).

---

_[View the full topic](https://discourse.mc-stan.org/t/improving-the-efficiency-of-fitting-a-model-using-stan-lmer/14237)._
