# Fixed Effects Models in Stan with Package

**URL:** <https://discourse.mc-stan.org/t/fixed-effects-models-in-stan-with-package/24887>\
**Category:** brms\
**Tags:** rstanarm, brms\
**Created:** [October 18, 2021, 8:18am UTC](https://discourse.mc-stan.org/t/fixed-effects-models-in-stan-with-package/24887 "2021-10-18T08:18:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jochen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jochen/32/4786_2.png) [@Jochen](https://discourse.mc-stan.org/u/Jochen)\
**Post date:** [October 18, 2021, 8:18am UTC](https://discourse.mc-stan.org/t/fixed-effects-models-in-stan-with-package/24887/1 "2021-10-18T08:18:13Z")

</div>

I’ve seen a lot of implementations of mixed-effects models in Stan. For example, I’ve been using brms to estimate a model with random effects for a grouping variable (e.g., store), that is comparable to what the lme4 package does with a “Frequentist” approach.

```
library(brms)
random_effects_model <- brm(revenue ~ sales + (1 | store_id))

```

However, I was wondering if there is also an implementation of fixed-effects models (i.e., incorporating store-level fixed effects to capture unobserved between-store heterogeneity in the contribution of a certain store to revenue), perhaps even in brms? Using a Frequentist approach, I was using the package lfe before:

```
library(lfe)
fixed_effects_model <- felm(revenue ~ sales | store_id)

```

Any ideas on how to do such thing in a Bayesian setting (using a package)? I want to avoid manual demeaning or inclusion of dummy variables (one dummy variable per store).

Thanks in advance.
